<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Parser Template</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
MathJax = {
	tex: {
		inlineMath: '$', '$'], ['\\(', '\\)'
	},
	svg: {
		fontCache: 'global'
	}
};
</script>
<script type="text/javascript" id="MathJax-script" async
	src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>

<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html">
<img src="../docs-assets/Inform.png" height=72">
</a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../indocn.html">indoc</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=18> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="../../../inweb/index.html">inweb</a></li>
<li><a href="../../../intest/index.html">intest</a></li>

</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Parser Template' generated by Inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../extensions.html">Kits</a></li><li><a href="index.html">CommandParserKit</a></li><li><b>Parser Template</b></li></ul></div>
<p class="purpose">The parser for turning the text of the typed command into a proposed action by the player.</p>

<ul class="toc"><li><a href="S-prs.html#SP1">&#167;1. A word about words</a></li><li><a href="S-prs.html#SP2">&#167;2. Identification</a></li><li><a href="S-prs.html#SP3">&#167;3. Parser Error Numbers</a></li><li><a href="S-prs.html#SP4">&#167;4. Grammar Line Variables</a></li><li><a href="S-prs.html#SP5">&#167;5. Grammar Token Variables</a></li><li><a href="S-prs.html#SP6">&#167;6. Match List Variables</a></li><li><a href="S-prs.html#SP7">&#167;7. Words</a></li><li><a href="S-prs.html#SP8">&#167;8. Snippets</a></li><li><a href="S-prs.html#SP9">&#167;9. Unpacking Grammar Lines</a></li><li><a href="S-prs.html#SP10">&#167;10. Keyboard Primitive</a></li><li><a href="S-prs.html#SP11">&#167;11. Reading the Command</a></li><li><a href="S-prs.html#SP12">&#167;12. Parser Proper</a></li><li><a href="S-prs.html#SP13">&#167;13. Parser Letter A</a></li><li><a href="S-prs.html#SP14">&#167;14. Parser Letter B</a></li><li><a href="S-prs.html#SP15">&#167;15. Parser Letter C</a></li><li><a href="S-prs.html#SP16">&#167;16. Parser Letter D</a></li><li><a href="S-prs.html#SP17">&#167;17. Parser Letter E</a></li><li><a href="S-prs.html#SP18">&#167;18. Parser Letter F</a></li><li><a href="S-prs.html#SP19">&#167;19. Parser Letter G</a></li><li><a href="S-prs.html#SP20">&#167;20. Parser Letter H</a></li><li><a href="S-prs.html#SP21">&#167;21. Parser Letter I</a></li><li><a href="S-prs.html#SP22">&#167;22. Parser Letter J</a></li><li><a href="S-prs.html#SP23">&#167;23. Parser Letter K</a></li><li><a href="S-prs.html#SP24">&#167;24. End of Parser Proper</a></li><li><a href="S-prs.html#SP25">&#167;25. Internal Rule</a></li><li><a href="S-prs.html#SP26">&#167;26. Parse Token</a></li><li><a href="S-prs.html#SP27">&#167;27. Parse Token Letter A</a></li><li><a href="S-prs.html#SP28">&#167;28. Parse Token Letter B</a></li><li><a href="S-prs.html#SP29">&#167;29. Parse Token Letter C</a></li><li><a href="S-prs.html#SP30">&#167;30. Parse Token Letter D</a></li><li><a href="S-prs.html#SP31">&#167;31. Parse Token Letter E</a></li><li><a href="S-prs.html#SP32">&#167;32. Parse Token Letter F</a></li><li><a href="S-prs.html#SP33">&#167;33. Descriptors</a></li><li><a href="S-prs.html#SP34">&#167;34. Parsing Descriptors</a></li><li><a href="S-prs.html#SP35">&#167;35. Preposition Chain</a></li><li><a href="S-prs.html#SP36">&#167;36. Creature</a></li><li><a href="S-prs.html#SP37">&#167;37. Noun Domain</a></li><li><a href="S-prs.html#SP38">&#167;38. Adjudicate</a></li><li><a href="S-prs.html#SP39">&#167;39. ReviseMulti</a></li><li><a href="S-prs.html#SP40">&#167;40. Match List</a></li><li><a href="S-prs.html#SP41">&#167;41. ScoreMatchL</a></li><li><a href="S-prs.html#SP42">&#167;42. BestGuess</a></li><li><a href="S-prs.html#SP43">&#167;43. SingleBestGuess</a></li><li><a href="S-prs.html#SP44">&#167;44. Identical</a></li><li><a href="S-prs.html#SP45">&#167;45. Print Command</a></li><li><a href="S-prs.html#SP46">&#167;46. CantSee</a></li><li><a href="S-prs.html#SP47">&#167;47. Multiple Object List</a></li><li><a href="S-prs.html#SP48">&#167;48. Scope</a></li><li><a href="S-prs.html#SP49">&#167;49. Scope Level 0</a></li><li><a href="S-prs.html#SP50">&#167;50. SearchScope</a></li><li><a href="S-prs.html#SP51">&#167;51. ScopeWithin</a></li><li><a href="S-prs.html#SP52">&#167;52. DoScopeActionAndRecurse</a></li><li><a href="S-prs.html#SP53">&#167;53. DoScopeAction</a></li><li><a href="S-prs.html#SP54">&#167;54. Parsing Object Names</a></li><li><a href="S-prs.html#SP55">&#167;55. TryGivenObject</a></li><li><a href="S-prs.html#SP56">&#167;56. Refers</a></li><li><a href="S-prs.html#SP57">&#167;57. NounWord</a></li><li><a href="S-prs.html#SP58">&#167;58. TryNumber</a></li><li><a href="S-prs.html#SP59">&#167;59. Gender</a></li><li><a href="S-prs.html#SP60">&#167;60. Noticing Plurals</a></li><li><a href="S-prs.html#SP61">&#167;61. Pronoun Handling</a></li><li><a href="S-prs.html#SP62">&#167;62. Yes/No Questions</a></li><li><a href="S-prs.html#SP63">&#167;63. Numerical Choices</a></li><li><a href="S-prs.html#SP64">&#167;64. Number Words</a></li><li><a href="S-prs.html#SP65">&#167;65. Tracing</a></li><li><a href="S-prs.html#SP66">&#167;66. Choose Objects</a></li><li><a href="S-prs.html#SP67">&#167;67. Default Topic</a></li><li><a href="S-prs.html#SP68">&#167;68. Recognition-only-GPR</a></li><li><a href="S-prs.html#SP69">&#167;69. RunRoutines</a></li><li><a href="S-prs.html#SP70">&#167;70. Setting the Player's Command</a></li><li><a href="S-prs.html#SP71">&#167;71. Multiple Object List</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. A word about words. </b>There are two slightly different versions of the command parser: one for the
16-bit architecture (i.e., the Z-machine), and the other for 32-bit (Glulx or C).
The main but not the only difference is that characters typed into the parser
are stored in single bytes in a 16-bit world, but will occupy words in a
32-bit world, and therefore can be arbitrary Unicode characters.
</p>

<p class="commentary">There are also minor differences in how the Z-machine stores the result of
identifying dictionary words in typed commands.
</p>

<p class="commentary">In general, though, <span class="extract"><span class="extract-syntax">#Iftrue CHARSIZE == 1;</span></span> will be used to conditionally
compile code for the 16-bit parser, and its alternative &mdash; that <span class="extract"><span class="extract-syntax">CHARSIZE</span></span>
equals <span class="extract"><span class="extract-syntax">WORDSIZE</span></span> &mdash; will mean the 32-bit parser.
</p>

<p class="commentary">Only when genuinely using some feature of the 16-bit architecture (i.e., of
the Z-machine) will we write <span class="extract"><span class="extract-syntax">#Ifdef TARGET_ZCODE;</span></span>. But this is only a
convention: <span class="extract"><span class="extract-syntax">TARGET_ZCODE</span></span> is defined here if and only if <span class="extract"><span class="extract-syntax">CHARSIZE</span></span> is 1,
and <span class="extract"><span class="extract-syntax">TARGET_GLULX</span></span> is defined if and only if <span class="extract"><span class="extract-syntax">CHARSIZE</span></span> is 4.
</p>

<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Identification. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">COMMANDPARSERKIT</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. Parser Error Numbers. </b>The traditional ways in which the I6 library's parser, which we adopt here
more or less intact, can give up on a player's command.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">         = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">UPTO_PE</span><span class="plain-syntax">          = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">NUMBER_PE</span><span class="plain-syntax">        = </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">ANIMA_PE</span><span class="plain-syntax">         = </span><span class="constant-syntax">4</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">CANTSEE_PE</span><span class="plain-syntax">       = </span><span class="constant-syntax">5</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">TOOLIT_PE</span><span class="plain-syntax">        = </span><span class="constant-syntax">6</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOTHELD_PE</span><span class="plain-syntax">       = </span><span class="constant-syntax">7</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTI_PE</span><span class="plain-syntax">         = </span><span class="constant-syntax">8</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">MMULTI_PE</span><span class="plain-syntax">        = </span><span class="constant-syntax">9</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">VAGUE_PE</span><span class="plain-syntax">         = </span><span class="constant-syntax">10</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">EXCEPT_PE</span><span class="plain-syntax">        = </span><span class="constant-syntax">11</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">VERB_PE</span><span class="plain-syntax">          = </span><span class="constant-syntax">12</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCENERY_PE</span><span class="plain-syntax">       = </span><span class="constant-syntax">13</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">ITGONE_PE</span><span class="plain-syntax">        = </span><span class="constant-syntax">14</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">JUNKAFTER_PE</span><span class="plain-syntax">     = </span><span class="constant-syntax">15</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">TOOFEW_PE</span><span class="plain-syntax">        = </span><span class="constant-syntax">16</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOTHING_PE</span><span class="plain-syntax">       = </span><span class="constant-syntax">17</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">ASKSCOPE_PE</span><span class="plain-syntax">      = </span><span class="constant-syntax">18</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOTINCONTEXT_PE</span><span class="plain-syntax">  = </span><span class="constant-syntax">19</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">BLANKLINE_PE</span><span class="plain-syntax">     = </span><span class="constant-syntax">20</span><span class="plain-syntax">; </span><span class="comment-syntax">Not formally a parser error, but used by I7 as if</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">ANIMAAGAIN_PE</span><span class="plain-syntax">    = </span><span class="constant-syntax">21</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">COMMABEGIN_PE</span><span class="plain-syntax">    = </span><span class="constant-syntax">22</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">MISSINGPERSON_PE</span><span class="plain-syntax"> = </span><span class="constant-syntax">23</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">ANIMALISTEN_PE</span><span class="plain-syntax">   = </span><span class="constant-syntax">24</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">TOTALK_PE</span><span class="plain-syntax">        = </span><span class="constant-syntax">25</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Grammar Line Variables. </b>This is the I6 library parser in mostly untouched form: reformatted for template
file use, and with paragraph divisions, but otherwise hardly changed at all.
It is a complex algorithm but one which is known to produce good results for
the most part, and it is well understood from (at time of writing) fifteen
years of use. A few I7 additions have been made, but none disrupting the
basic method. For instance, I7's system for resolving ambiguities is
implemented by providing a <span class="extract"><span class="extract-syntax">ChooseObjects</span></span> routine, just as a user of the
I6 library would do.
</p>

<p class="commentary">The I6 parser uses a huge number of global variables, which is not to modern
programming tastes: in the early days of Inform, the parser was essentially
written in assembly-language only lightly structured by C-like syntaxes,
and the Z-machine's 240 globals were more or less registers. The I6 library
made no distinction between which were "private" to the parser and which
allowed to be accessed by the user's code at large. The I7 template does
impose that boundary, though not very strongly: the variables defined
in "Output.i6t" are for general access, while the ones below should only
be read or written by the parser.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">etype</span><span class="plain-syntax">;                       </span><span class="comment-syntax">parser error number if command not recognised</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax">;                  </span><span class="comment-syntax">Preferred error number so far</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">nextbest_etype</span><span class="plain-syntax">;              </span><span class="comment-syntax">Preferred one, if ASKSCOPE_PE disallowed</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">parser_inflection</span><span class="plain-syntax">;           </span><span class="comment-syntax">A property (usually "name") to find object names in</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indirect_parser_inflection</span><span class="plain-syntax">;  </span><span class="comment-syntax">Set this to have parser_inflection called</span>

<span class="reserved-syntax">Array</span><span class="plain-syntax"> </span><span class="identifier-syntax">pattern</span><span class="plain-syntax"> --&gt; </span><span class="constant-syntax">32</span><span class="plain-syntax">;               </span><span class="comment-syntax">For the current pattern match</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">;                      </span><span class="comment-syntax">and a marker within it</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax"> </span><span class="identifier-syntax">pattern2</span><span class="plain-syntax"> --&gt; </span><span class="constant-syntax">32</span><span class="plain-syntax">;              </span><span class="comment-syntax">And another, which stores the best match</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">pcount2</span><span class="plain-syntax">;                     </span><span class="comment-syntax">so far</span>

<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;32;             </span><span class="comment-syntax">For storing an analysed grammar line</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;32;</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;32;</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">nsns</span><span class="plain-syntax">;                        </span><span class="comment-syntax">Number of special_numbers entered so far</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">params_wanted</span><span class="plain-syntax">;               </span><span class="comment-syntax">Number of parameters needed (which may change in parsing)</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax">;                   </span><span class="comment-syntax">The point from which the rest of the command must be inferred</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">inferword</span><span class="plain-syntax">;                   </span><span class="comment-syntax">And the preposition inferred</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">dont_infer_pronoun</span><span class="plain-syntax">;          </span><span class="comment-syntax">Do not infer an "it"</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">dont_infer</span><span class="plain-syntax">;                  </span><span class="comment-syntax">Another dull flag</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">cobj_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">;                   </span><span class="comment-syntax">The "first mistake" word number</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved_oops</span><span class="plain-syntax">;                  </span><span class="comment-syntax">Used in working this out</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">oops_workspace</span><span class="plain-syntax"> -&gt; </span><span class="constant-syntax">64</span><span class="plain-syntax">;        </span><span class="comment-syntax">Used temporarily by "oops" routine</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">oops_workspace</span><span class="plain-syntax"> --&gt; </span><span class="constant-syntax">64</span><span class="plain-syntax">;       </span><span class="comment-syntax">Used temporarily by "oops" routine</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">held_back_mode</span><span class="plain-syntax">;              </span><span class="comment-syntax">Flag: is there some input from last time</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">hb_wn</span><span class="plain-syntax">;                       </span><span class="comment-syntax">left over?  (And a save value for wn.)</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">(Used for full stops and "then".)</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">usual_grammar_after</span><span class="plain-syntax">;         </span><span class="comment-syntax">Point from which usual grammar is parsed (it may vary from</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">the above if user's routines match multi-word verbs)</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">dont_ask_for_clarification</span><span class="plain-syntax">;  </span><span class="comment-syntax">Allows deactivating clarification question</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. Grammar Token Variables. </b>More globals, but dealing at the level of individual tokens now.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">PATTERN_NULL</span><span class="plain-syntax"> = </span><span class="constant-syntax">$ffff</span><span class="plain-syntax">;      </span><span class="comment-syntax">Entry for a token producing no text</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax">;                 </span><span class="comment-syntax">Used to break up tokens into type</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">found_tdata</span><span class="plain-syntax">;                 </span><span class="comment-syntax">and data (by AnalyseToken)</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">;                </span><span class="comment-syntax">For noun filtering by user routines</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">length_of_noun</span><span class="plain-syntax">;              </span><span class="comment-syntax">Set by NounDomain to no of words in noun</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">lookahead</span><span class="plain-syntax">;                   </span><span class="comment-syntax">The token after the one now being matched</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">multi_mode</span><span class="plain-syntax">;                  </span><span class="comment-syntax">Multiple mode</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">multi_wanted</span><span class="plain-syntax">;                </span><span class="comment-syntax">Number of things needed in multitude</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">multi_had</span><span class="plain-syntax">;                   </span><span class="comment-syntax">Number of things actually found</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">multi_context</span><span class="plain-syntax">;               </span><span class="comment-syntax">What token the multi-obj was accepted for</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax">;                  </span><span class="comment-syntax">Bit-map holding types of specification</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">;                </span><span class="comment-syntax">Number of items wanted (INDEF_ALL_WANTED for all)</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax"> = </span><span class="constant-syntax">32767</span><span class="plain-syntax">;</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_guess_p</span><span class="plain-syntax">;               </span><span class="comment-syntax">Plural-guessing flag</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax">;                 </span><span class="comment-syntax">Object which must hold these items</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax">;                 </span><span class="comment-syntax">Possible gender and numbers of them</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax">;             </span><span class="comment-syntax">Has a possibly dangerous assumption</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">been made about meaning of a descriptor?</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax">;              </span><span class="comment-syntax">Word at which a number like "two" was parsed</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">(for backtracking)</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">allow_plurals</span><span class="plain-syntax">;               </span><span class="comment-syntax">Whether plurals presently allowed or not</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax">;               </span><span class="comment-syntax">Slightly different rules apply to "take all" than other uses</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">of multiple objects, to make adjudication produce more</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">pragmatically useful results</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">(Not a flag: possible values 0, 1, 2)</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax">;      </span><span class="comment-syntax">True or false</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">pronoun__word</span><span class="plain-syntax">;               </span><span class="comment-syntax">Saved value</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">pronoun__obj</span><span class="plain-syntax">;                </span><span class="comment-syntax">Saved value</span>

<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax"> = </span><span class="character-syntax">'comma,'</span><span class="plain-syntax">;     </span><span class="comment-syntax">An "untypeable word" used to substitute</span>
<span class="plain-syntax">                                    </span><span class="comment-syntax">for commas in parse buffers</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Match List Variables. </b>The most difficult tokens to match are those which refer to objects, since
there is such a variety of names which can be given to any individual object,
and we don't of course know which object or objects are meant. We store the
possibilities (up to <span class="extract"><span class="extract-syntax">MATCH_LIST_WORDS</span></span>, anyway) in a data structure called the match list.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WorldModelKit</span><span class="plain-syntax">`</span><span class="identifier-syntax">MULTI_OBJ_LIST_SIZE_CFGV</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">match_list</span><span class="plain-syntax"> --&gt; </span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax">;    </span><span class="comment-syntax">An array of matched objects so far</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax"> --&gt; </span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax">; </span><span class="comment-syntax">An array of equivalence classes for them</span>
<span class="reserved-syntax">Array</span><span class="plain-syntax">  </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax"> --&gt; </span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax">;  </span><span class="comment-syntax">An array of match scores for them</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">;              </span><span class="comment-syntax">How many items in it?  (0 means none)</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax">;           </span><span class="comment-syntax">How many equivalence classes?</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">;                </span><span class="comment-syntax">How many words long are these matches?</span>
<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">;                  </span><span class="comment-syntax">At what word of the input do they begin?</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Words. </b>The player's command is broken down into a numbered sequence of words, which
break at spaces or certain punctuation (see the DM4). The numbering runs
upwards from 1 to <span class="extract"><span class="extract-syntax">WordCount()</span></span>. The following utility routines provide
access to words in the current command; because buffers have different
definitions in Z and Glulx, so these routines must vary also.
</p>

<p class="commentary">In Z, the actual text of each word is stored as a sequence of ZSCII values in
a <span class="extract"><span class="extract-syntax">-&gt;</span></span> (byte) array. In G, the text is a sequence of Unicode code counts in
a <span class="extract"><span class="extract-syntax">--&gt;</span></span> (word) array. In either case, the array has address <span class="extract"><span class="extract-syntax">WordAddress(x)</span></span>
and character length <span class="extract"><span class="extract-syntax">WordLength(x)</span></span>.
</p>

<p class="commentary">We picture the command as a stream of words to be read one at a time, with
the global variable <span class="extract"><span class="extract-syntax">wn</span></span> being the "current word" marker. <span class="extract"><span class="extract-syntax">NextWord</span></span>, which
takes no arguments, returns:
</p>

<ul class="items"><li>(a) 0 if the word at <span class="extract"><span class="extract-syntax">wn</span></span> is unrecognised by the dictionary or <span class="extract"><span class="extract-syntax">wn</span></span> is out
of range,
</li><li>(b) <span class="extract"><span class="extract-syntax">comma_word</span></span> if the word was a comma,
</li><li>(c) <span class="extract"><span class="extract-syntax">THEN1__WD</span></span> if it was a full stop (because of the Infocom tradition that
a full stop abbreviates for the word "then": e.g., TAKE BOX. EAST was read
as two commands in succession),
</li><li>(d) or the dictionary address if the word was recognised.
</li></ul>
<p class="commentary">The current word marker <span class="extract"><span class="extract-syntax">wn</span></span> is always advanced.
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">NextWordStopped</span></span> does the same, but returns \(-1\) when <span class="extract"><span class="extract-syntax">wn</span></span> is out of range
(e.g., by having advanced past the last word in the command).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">#</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse</span><span class="plain-syntax">-&gt;1; ];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax"> </span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">buffer</span><span class="plain-syntax"> + </span><span class="identifier-syntax">parse</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">*4+1); ];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">WordLength</span><span class="plain-syntax"> </span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">*4); ];</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;0; ];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax"> </span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">buffer</span><span class="plain-syntax"> + </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax"> * </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">*3); ];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">WordLength</span><span class="plain-syntax"> </span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">*3 - </span><span class="constant-syntax">1</span><span class="plain-syntax">); ];</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">WordFrom</span><span class="plain-syntax"> </span><span class="identifier-syntax">w</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">wc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;1; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">w</span><span class="plain-syntax">*2-1;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">--&gt;0; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">w</span><span class="plain-syntax">*3-2;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">w</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">wc</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="character-syntax">',//'</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="character-syntax">'.//'</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">wc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">-&gt;1; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">*2-1;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;0; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">*3-2;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">2</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">wc</span><span class="plain-syntax">+1)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="character-syntax">',//'</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="character-syntax">'.//'</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax"> </span><span class="identifier-syntax">wc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">-&gt;1;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">wc</span><span class="plain-syntax">)) { </span><span class="identifier-syntax">wn</span><span class="plain-syntax">++; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Snippets. </b>Although the idea is arguably implicit in I6, the formal concept of
"snippet" is new in I7. A snippet is a value which represents a word
range in the command most recently typed by the player. These words number
consecutively upwards from 1, as noted above. The correspondence between
\((w_1, w_2)\), the word range, and \(V\), the number used to represent it as
an I6 value, is:
$$ V = 100w_1 + (w_2-w_1+1) $$
so that the remainder mod 100 is the number of words in the range. We
require that \(1\leq w_1\leq w_2\leq N\), where \(N\) is the number of words in
the current player's command. The entire command is therefore represented by:
$$ C = 100 + N $$
</p>

<p class="commentary">A careless bug in this code lasted for many years: on a 16-bit architecture
we have to remember that addresses in byte-addressable memory are potentially
signed, and the loop <span class="extract"><span class="extract-syntax">for (i=from: i&lt;=to: ...)</span></span> will fail if the addresses
are above 32K. This only rarely happens, but it can.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">+</span><span class="identifier-syntax">replacing</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">) [ </span><span class="identifier-syntax">PrintSnippet</span><span class="plain-syntax"> </span><span class="identifier-syntax">snip</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="reserved-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> </span><span class="identifier-syntax">w2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">snip</span><span class="plain-syntax">/100; </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> + (</span><span class="identifier-syntax">snip</span><span class="plain-syntax">%100) - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w2</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">w1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">w1</span><span class="plain-syntax">&lt;1) || (</span><span class="identifier-syntax">w2</span><span class="plain-syntax">&gt;</span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">())) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w1</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">w2</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"SaidInvalidSnippet"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"Attempt to say a snippet value which is currently invalid."</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WorldModelKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** The snippet ran from words "</span><span class="plain-syntax">, </span><span class="identifier-syntax">w1</span><span class="plain-syntax">, </span><span class="string-syntax">" to "</span><span class="plain-syntax">, </span><span class="identifier-syntax">w2</span><span class="plain-syntax">, </span><span class="string-syntax">".^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">w1</span><span class="plain-syntax">); </span><span class="reserved-syntax">to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">w2</span><span class="plain-syntax">) + </span><span class="identifier-syntax">WordLength</span><span class="plain-syntax">(</span><span class="identifier-syntax">w2</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="reserved-syntax">to</span><span class="plain-syntax">-</span><span class="identifier-syntax">from</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="identifier-syntax">from</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">w1</span><span class="plain-syntax">); </span><span class="reserved-syntax">to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">w2</span><span class="plain-syntax">) + </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax"> * (</span><span class="identifier-syntax">WordLength</span><span class="plain-syntax">(</span><span class="identifier-syntax">w2</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">from</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="reserved-syntax">to</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">SpliceSnippet</span><span class="plain-syntax"> </span><span class="identifier-syntax">snip</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> </span><span class="identifier-syntax">nextw</span><span class="plain-syntax"> </span><span class="identifier-syntax">at</span><span class="plain-syntax"> </span><span class="identifier-syntax">endsnippet</span><span class="plain-syntax"> </span><span class="identifier-syntax">newlen</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">snip</span><span class="plain-syntax">/100; </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> + (</span><span class="identifier-syntax">snip</span><span class="plain-syntax">%100) - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w2</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">w1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">w1</span><span class="plain-syntax">&lt;1)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w1</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">w2</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"SplicedInvalidSnippet"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"Attempt to splice a snippet value which is currently invalid."</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WorldModelKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** The snippet ran from words "</span><span class="plain-syntax">, </span><span class="identifier-syntax">w1</span><span class="plain-syntax">, </span><span class="string-syntax">" to "</span><span class="plain-syntax">, </span><span class="identifier-syntax">w2</span><span class="plain-syntax">, </span><span class="string-syntax">".^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">say__p</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">say__pc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">nextw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">w1</span><span class="plain-syntax">) - </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">w1</span><span class="plain-syntax">) - </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">) / </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nextw</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">()) </span><span class="identifier-syntax">endsnippet</span><span class="plain-syntax"> = </span><span class="constant-syntax">100</span><span class="plain-syntax">*</span><span class="identifier-syntax">nextw</span><span class="plain-syntax"> + (</span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">() - </span><span class="identifier-syntax">nextw</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">saved</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">newlen</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VM_PrintToBuffer</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">, </span><span class="identifier-syntax">SpliceSnippet__TextPrinter</span><span class="plain-syntax">, </span><span class="identifier-syntax">t</span><span class="plain-syntax">, </span><span class="identifier-syntax">endsnippet</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0: (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">newlen</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">): </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 = </span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (:</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">:</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0: (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">newlen</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">): </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;(1+</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (:</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">:</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">saved</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">say__pc</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">say__p</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">SpliceSnippet__TextPrinter</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> </span><span class="identifier-syntax">endsnippet</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEXT_TY_Say</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">endsnippet</span><span class="plain-syntax">) { </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" "</span><span class="plain-syntax">; </span><span class="identifier-syntax">PrintSnippet</span><span class="plain-syntax">(</span><span class="identifier-syntax">endsnippet</span><span class="plain-syntax">); }</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">SnippetIncludes</span><span class="plain-syntax"> </span><span class="identifier-syntax">test</span><span class="plain-syntax"> </span><span class="identifier-syntax">snippet</span><span class="plain-syntax"> </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> </span><span class="identifier-syntax">wlen</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">snippet</span><span class="plain-syntax">/100; </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">w1</span><span class="plain-syntax"> + (</span><span class="identifier-syntax">snippet</span><span class="plain-syntax">%100) - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w2</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">w1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">w1</span><span class="plain-syntax">&lt;1)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w1</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">w2</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"IncludedInvalidSnippet"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"Attempt to match a snippet value which is currently invalid."</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WorldModelKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** The snippet ran from words "</span><span class="plain-syntax">, </span><span class="identifier-syntax">w1</span><span class="plain-syntax">, </span><span class="string-syntax">" to "</span><span class="plain-syntax">, </span><span class="identifier-syntax">w2</span><span class="plain-syntax">, </span><span class="string-syntax">".^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">metaclass</span><span class="plain-syntax">(</span><span class="identifier-syntax">test</span><span class="plain-syntax">) == </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wlen</span><span class="plain-syntax"> = </span><span class="identifier-syntax">snippet</span><span class="plain-syntax">%100;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">w1</span><span class="plain-syntax">, </span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">wlen</span><span class="plain-syntax">: </span><span class="identifier-syntax">j</span><span class="plain-syntax">&gt;0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++, </span><span class="identifier-syntax">j</span><span class="plain-syntax">--) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">test</span><span class="plain-syntax">)(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)) ~= </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">*100+</span><span class="identifier-syntax">wn</span><span class="plain-syntax">-</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">SnippetMatches</span><span class="plain-syntax"> </span><span class="identifier-syntax">snippet</span><span class="plain-syntax"> </span><span class="identifier-syntax">topic_gpr</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax">=1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">topic_gpr</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">metaclass</span><span class="plain-syntax">(</span><span class="identifier-syntax">topic_gpr</span><span class="plain-syntax">) == </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">topic_gpr</span><span class="plain-syntax">)(</span><span class="identifier-syntax">snippet</span><span class="plain-syntax">/100, </span><span class="identifier-syntax">snippet</span><span class="plain-syntax">%100);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rv</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"MatchedAgainstNonTopic"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Tried to see if a snippet of text matches something which is not a topic."</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WorldModelKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Unpacking Grammar Lines. </b>Grammar lines are sequences of tokens in an array built into the story file,
but in a format which differs depending on the virtual machine in use, so
the following code unpacks the data into more convenient if larger arrays
which are VM-independent.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">UnpackGrammarLine</span><span class="plain-syntax"> </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;32 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">TARGET_ZCODE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> = </span><span class="constant-syntax">256</span><span class="plain-syntax">*(</span><span class="identifier-syntax">line_address</span><span class="plain-syntax">-&gt;0) + </span><span class="identifier-syntax">line_address</span><span class="plain-syntax">-&gt;1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">action_reversed</span><span class="plain-syntax"> = ((</span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">$400</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> = </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">$3ff</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">line_address</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">size</span><span class="plain-syntax"> = </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">; </span><span class="comment-syntax">GLULX</span>

<span class="plain-syntax">    @</span><span class="identifier-syntax">aloads</span><span class="plain-syntax"> </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">action_reversed</span><span class="plain-syntax"> = (((</span><span class="identifier-syntax">line_address</span><span class="plain-syntax">-&gt;2) &amp; </span><span class="constant-syntax">1</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> = </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> - </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">size</span><span class="plain-syntax"> = </span><span class="constant-syntax">5</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">params_wanted</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> = </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> + </span><span class="identifier-syntax">size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_address</span><span class="plain-syntax">-&gt;0 == </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">line_address</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">AnalyseToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">line_address</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">) </span><span class="identifier-syntax">params_wanted</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">found_tdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">AnalyseToken</span><span class="plain-syntax"> </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">found_tdata</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;0) &amp; </span><span class="constant-syntax">$$1111</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">found_tdata</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">token</span><span class="plain-syntax">+1)--&gt;0;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Keyboard Primitive. </b>This is the primitive routine to read from the keyboard: it usually delegates
this to a routine specific to the virtual machine being used, but sometimes
uses a hacked version to allow TEST commands to work. (When a TEST is running,
the text in the walk-through provided is fed into the buffer as if it had
been typed at the keyboard.)
</p>

<p class="commentary">If a <span class="extract"><span class="extract-syntax">fn</span></span> is provided, it is called to redraw the status line at the top of
the main text window.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">KeyboardPrimitive</span><span class="plain-syntax"> </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax"> </span><span class="identifier-syntax">a_table</span><span class="plain-syntax"> </span><span class="identifier-syntax">fn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TestKeyboardPrimitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">KeyboardMorePrimitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">KeyboardMorePrimitive</span><span class="plain-syntax"> </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax"> </span><span class="identifier-syntax">a_table</span><span class="plain-syntax"> </span><span class="identifier-syntax">fn</span><span class="plain-syntax"> </span><span class="identifier-syntax">ix</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fn</span><span class="plain-syntax">) </span><span class="identifier-syntax">fn</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM_ReadKeyboard</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">`</span><span class="identifier-syntax">ECHO_COMMANDS_CFGF</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"** "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ix</span><span class="plain-syntax">=2: </span><span class="identifier-syntax">ix</span><span class="plain-syntax">&lt;=(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;1)+1: </span><span class="identifier-syntax">ix</span><span class="plain-syntax">++) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">ix</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ix</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">ix</span><span class="plain-syntax">&lt;(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;0): </span><span class="identifier-syntax">ix</span><span class="plain-syntax">++) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;(1+</span><span class="identifier-syntax">ix</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Reading the Command. </b>The <span class="extract"><span class="extract-syntax">Keyboard</span></span> routine actually receives the player's words, putting the
words in <span class="extract"><span class="extract-syntax">a_buffer</span></span> and their dictionary addresses in <span class="extract"><span class="extract-syntax">a_table</span></span>. It is
assumed that the table is the same one on each (standard) call. Much
of the code handles the OOPS and UNDO commands, which are not actions and
do not pass through the rest of the parser. The undo state is saved &mdash;
it is essentially an internal saved game, in the VM interpreter's memory
rather than in an external file &mdash; and note that this is therefore also
where execution picks up if an UNDO has been typed. Since UNDO recreates
the former machine state perfectly, it might seem impossible to tell that
an UNDO had occurred, but in fact the VM passes information back in the
form of a return code from the relevant instruction, and this allows us
to detect an undo. (We deal with it by printing the current location and
asking another command.)
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">Keyboard</span></span> can also be used by miscellaneous routines in the game to ask
yes/no questions and the like, without invoking the rest of the parser.
</p>

<p class="commentary">The return value is the number of words typed.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">Keyboard</span><span class="plain-syntax">  </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax"> </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">  </span><span class="identifier-syntax">nw</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">w</span><span class="plain-syntax"> </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> </span><span class="identifier-syntax">x1</span><span class="plain-syntax"> </span><span class="identifier-syntax">x2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sline1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">score</span><span class="plain-syntax">; </span><span class="identifier-syntax">sline2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">turns</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="reserved-syntax">true</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Save the start of the buffer, in case "oops" needs to restore it</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;64 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">oops_workspace</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;64 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">oops_workspace</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">In case of an array entry corruption that shouldn't happen, but would be</span>
<span class="plain-syntax">        </span><span class="comment-syntax">disastrous if it did:</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;0 = </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">-&gt;0 = </span><span class="constant-syntax">15</span><span class="plain-syntax">;  </span><span class="comment-syntax">Allow to split input into this many words</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">TARGET_</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Print the prompt, and read in the words and dictionary addresses</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PrintPrompt</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KeyboardPrimitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">, </span><span class="identifier-syntax">DrawStatusLine</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Set nw to the number of words</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">nw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">-&gt;1;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">nw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">If the line was blank, get a fresh line</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nw</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">etype</span><span class="plain-syntax">; </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">BLANKLINE_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">players_command</span><span class="plain-syntax"> = </span><span class="constant-syntax">100</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_PARSER_ERROR_ACT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_PARSER_ERROR_ACT</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'X'</span><span class="plain-syntax">, </span><span class="identifier-syntax">noun</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_PARSER_ERROR_ACT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">etype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Unless the opening word was OOPS, return</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Conveniently, a_table--&gt;1 is the first word on both the Z-machine and Glulx</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">--&gt;1;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w</span><span class="plain-syntax"> == </span><span class="identifier-syntax">OOPS1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">OOPS2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">OOPS3__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">oops_from</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_COMMAND_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nw</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_COMMAND_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nw</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">2</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_COMMAND_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'C'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">            </span><span class="comment-syntax">So now we know: there was a previous mistake, and the player has</span>
<span class="plain-syntax">            </span><span class="comment-syntax">attempted to correct a single word of it.</span>

<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">x1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">-&gt;9;  </span><span class="comment-syntax">Start of word following "oops"</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">x2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">-&gt;8;  </span><span class="comment-syntax">Length of word following "oops"</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">x1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">--&gt;6; </span><span class="comment-syntax">Start of word following "oops"</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">x2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">--&gt;5; </span><span class="comment-syntax">Length of word following "oops"</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="comment-syntax">Repair the buffer to the text that was in it before the "oops"</span>
<span class="plain-syntax">            </span><span class="comment-syntax">was typed:</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;64 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">oops_workspace</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;64 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">oops_workspace</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">,</span><span class="identifier-syntax">a_table</span><span class="plain-syntax">);</span>

<span class="plain-syntax">            </span><span class="comment-syntax">Work out the position in the buffer of the word to be corrected:</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">-&gt;(4*</span><span class="identifier-syntax">oops_from</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="comment-syntax">Start of word to go</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">-&gt;(4*</span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">);    </span><span class="comment-syntax">Length of word to go</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">--&gt;(3*</span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">);      </span><span class="comment-syntax">Start of word to go</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">w2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">--&gt;(3*</span><span class="identifier-syntax">oops_from</span><span class="plain-syntax"> - </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="comment-syntax">Length of word to go</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="comment-syntax">Write spaces over the word to be corrected:</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">w2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">w</span><span class="plain-syntax">) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">w2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">w</span><span class="plain-syntax">) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w2</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">x2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="comment-syntax">If the replacement is longer than the original, move up...</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;=</span><span class="identifier-syntax">w</span><span class="plain-syntax">+</span><span class="identifier-syntax">x2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">--)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-</span><span class="identifier-syntax">x2</span><span class="plain-syntax">+</span><span class="identifier-syntax">w2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;=</span><span class="identifier-syntax">w</span><span class="plain-syntax">+</span><span class="identifier-syntax">x2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">--)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-</span><span class="identifier-syntax">x2</span><span class="plain-syntax">+</span><span class="identifier-syntax">w2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">                </span><span class="comment-syntax">...increasing buffer size accordingly.</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;1 = (</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;1) + (</span><span class="identifier-syntax">x2</span><span class="plain-syntax">-</span><span class="identifier-syntax">w2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;0 = (</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;0) + (</span><span class="identifier-syntax">x2</span><span class="plain-syntax">-</span><span class="identifier-syntax">w2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            </span><span class="comment-syntax">Write the correction in:</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">x2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">w</span><span class="plain-syntax">) = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">x1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">x2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">w</span><span class="plain-syntax">) = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">x1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">nw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">-&gt;1;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">nw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a_table</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">nw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Undo handling</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w</span><span class="plain-syntax"> == </span><span class="identifier-syntax">UNDO1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNDO2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNDO3__WD</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">nw</span><span class="plain-syntax">==1)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Perform_Undo</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VM_Save_Undo</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CommandParserKit</span><span class="plain-syntax">`</span><span class="identifier-syntax">UNDO_PREVENTION_CFGF</span><span class="plain-syntax">) </span><span class="identifier-syntax">undo_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">undo_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == -1) </span><span class="identifier-syntax">undo_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">undo_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DealWithUndo</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">nw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">DealWithUndo</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM_Style</span><span class="plain-syntax">(</span><span class="identifier-syntax">SUBHEADER_VMSTY</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">SL_Location</span><span class="plain-syntax">(); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM_Style</span><span class="plain-syntax">(</span><span class="identifier-syntax">NORMAL_VMSTY</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IMMEDIATELY_UNDO_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'E'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax"> </span><span class="identifier-syntax">buf</span><span class="plain-syntax"> </span><span class="identifier-syntax">tab</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  </span><span class="identifier-syntax">VM_Tokenise</span><span class="plain-syntax">(</span><span class="identifier-syntax">buf</span><span class="plain-syntax">, </span><span class="identifier-syntax">tab</span><span class="plain-syntax">);</span>
<span class="plain-syntax">  </span><span class="identifier-syntax">num_words</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">();</span>
<span class="plain-syntax">  </span><span class="identifier-syntax">players_command</span><span class="plain-syntax"> = </span><span class="constant-syntax">100</span><span class="plain-syntax"> + </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Parser Proper. </b>The main parser routine is something of a leviathan, and it has traditionally
been divided into 11 lettered parts:
</p>

<ul class="items"><li>(A) Get the input, do OOPS and AGAIN
</li><li>(B) Is it a direction, and so an implicit GO?  If so go to (K)
</li><li>(C) Is anyone being addressed?
</li><li>(D) Get the command verb: try all the syntax lines for that verb
</li><li>(E) Break down a syntax line into analysed tokens
</li><li>(F) Look ahead for advance warning for <span class="extract"><span class="extract-syntax">multiexcept</span></span>/<span class="extract"><span class="extract-syntax">multiinside</span></span>
</li><li>(G) Parse each token in turn (calling <span class="extract"><span class="extract-syntax">ParseToken</span></span> to do most of the work)
</li><li>(H) Cheaply parse otherwise unrecognised conversation and return
</li><li>(I) Print best possible error message
</li><li>(J) Retry the whole lot
</li><li>(K) Last thing: check for THEN and further instructions(s), return.
</li></ul>
<p class="commentary">This lettering has been preserved here, with the code under each letter
now being the body of "Parser Letter A", "Parser Letter B" and so on.
</p>

<p class="commentary">Note that there are three different places where a return can happen.
The routine returns only when a sensible request has been made; for a
fairly thorough description of its output, which is written into the
<span class="extract"><span class="extract-syntax">parser_results</span></span> array and also into several globals (see "OrderOfPlay.i6t").
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">Parser__parse</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">syntax</span><span class="plain-syntax"> </span><span class="identifier-syntax">line</span><span class="plain-syntax"> </span><span class="identifier-syntax">num_lines</span><span class="plain-syntax"> </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">token</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax"> </span><span class="identifier-syntax">inferred_go</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cobj_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">NO_INPS_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">meta</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. Parser Letter A. </b>Get the input, do OOPS and AGAIN.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">held_back_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">held_back_mode</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">; </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">hb_wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(1);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">j</span><span class="plain-syntax">) </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;0 = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">j</span><span class="plain-syntax">) </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">--&gt;0 = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">AGAIN1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AGAIN2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AGAIN3__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="comment-syntax">Delete the words "then again" from the again buffer,</span>
<span class="plain-syntax">            </span><span class="comment-syntax">in which we have just realised that it must occur:</span>
<span class="plain-syntax">            </span><span class="comment-syntax">prevents an infinite loop on "i. again"</span>

<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">-2)-</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-1;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">)-</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">-2)-</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">) / </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-1;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">)-</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">) / </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReParse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">ReType</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">cobj_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">player</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">READING_A_COMMAND_ACT</span><span class="plain-syntax">); </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">READING_A_COMMAND_ACT</span><span class="plain-syntax">)==</span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Keyboard</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">,</span><span class="identifier-syntax">parse</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">num_words</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">(); </span><span class="identifier-syntax">players_command</span><span class="plain-syntax"> = </span><span class="constant-syntax">100</span><span class="plain-syntax"> + </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">READING_A_COMMAND_ACT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReType</span><span class="plain-syntax">;</span>
<span class="plain-syntax">  .</span><span class="identifier-syntax">ReParse</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">parser_inflection</span><span class="plain-syntax"> = </span><span class="identifier-syntax">name</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Initially assume the command is aimed at the player, and the verb</span>
<span class="plain-syntax">    </span><span class="comment-syntax">is the first word</span>

<span class="plain-syntax">    </span><span class="comment-syntax">num_words = WordCount(); players_command = 100 + num_words;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">inferred_go</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LanguageToInformese</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="comment-syntax">Re-tokenise:</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">,</span><span class="identifier-syntax">parse</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">allow_plurals</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; </span><span class="identifier-syntax">ResetDescriptors</span><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax">=0;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[ "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">num_words</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>

<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">*2 + </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">*3 + </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordLength</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"~"</span><span class="plain-syntax">; </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">m</span><span class="plain-syntax">++) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="identifier-syntax">k</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax">; </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"~ "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"~"</span><span class="plain-syntax">; </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">m</span><span class="plain-syntax">++) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="identifier-syntax">k</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax">; </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"~ "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"?"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM_ProbablyDictionaryAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">j</span><span class="plain-syntax">)) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">-1) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" / "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" ]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">player</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">player</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">usual_grammar_after</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">AlmostReParse</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Begin from what we currently think is the verb word</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">BeginCommand</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="comment-syntax">If there's no input here, we must have something like "person,".</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> == -1) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> == </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">COMMABEGIN_PE</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Now try for "again" or "g", which are special cases: don't allow "again" if nothing</span>
<span class="plain-syntax">    </span><span class="comment-syntax">has previously been typed; simply copy the previous text across</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> == </span><span class="identifier-syntax">AGAIN2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AGAIN3__WD</span><span class="plain-syntax">) </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">AGAIN1__WD</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> == </span><span class="identifier-syntax">AGAIN1__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">actor</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">player</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ANIMAAGAIN_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">-&gt;1 == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PARSER_COMMAND_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'D'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReType</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">--&gt;0 == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PARSER_COMMAND_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'D'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReType</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">CHARSIZE</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">,</span><span class="identifier-syntax">parse</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReParse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Save the present input in case of an "again" next time</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">AGAIN1__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer3</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">usual_grammar_after</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RunRoutines</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="identifier-syntax">grammar</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">actor</span><span class="plain-syntax">.</span><span class="identifier-syntax">grammar</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" [Grammar property returned "</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">VM_InvalidDictionaryAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">usual_grammar_after</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">=-</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">action</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">NO_INPS_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">noun</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">second</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">noun</span><span class="plain-syntax">) </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">NO_INPS_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">second</span><span class="plain-syntax">) </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">NO_INPS_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">; </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--; </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">--; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> { </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">; </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">(); }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">usual_grammar_after</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. Parser Letter B. </b>Is the command a direction name, and so an implicit GO? If so, go to (K).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageIsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse</span><span class="plain-syntax">, </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If the first word is not listed as a verb, it must be a direction</span>
<span class="plain-syntax">    </span><span class="comment-syntax">or the name of someone to talk to</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordMarkedAsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">So is the first word an object contained in the special object "compass"</span>
<span class="plain-syntax">        </span><span class="comment-syntax">(i.e., a direction)?  This needs use of NounDomain, a routine which</span>
<span class="plain-syntax">        </span><span class="comment-syntax">does the object matching, returning the object number, or 0 if none found,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">or REPARSE_CODE if it has restructured the parse table so the whole parse</span>
<span class="plain-syntax">        </span><span class="comment-syntax">must be begun again...</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">; </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">actor</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">action</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">player</span><span class="plain-syntax">; </span><span class="identifier-syntax">meta</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">; </span><span class="identifier-syntax">action</span><span class="plain-syntax"> = ##</span><span class="identifier-syntax">Go</span><span class="plain-syntax">; </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> = ##</span><span class="identifier-syntax">Go</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NounDomain</span><span class="plain-syntax">(</span><span class="identifier-syntax">Compass</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">action</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">actor</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReParse</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">If it is a direction, send back the results:</span>
<span class="plain-syntax">        </span><span class="comment-syntax">action=GoSub, no of arguments=1, argument 1=the direction.</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">l</span><span class="plain-syntax">~=0) &amp;&amp; (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K3_direction</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = ##</span><span class="identifier-syntax">Go</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">NO_INPS_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inferred_go</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">LookForMore</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    } </span><span class="comment-syntax">end of first-word-not-a-verb</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. Parser Letter C. </b>Is anyone being addressed?
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">Only check for a comma (a "someone, do something" command) if we are</span>
<span class="plain-syntax">    </span><span class="comment-syntax">not already in the middle of one.  (This simplification stops us from</span>
<span class="plain-syntax">    </span><span class="comment-syntax">worrying about "robot, wizard, you are an idiot", telling the robot to</span>
<span class="plain-syntax">    </span><span class="comment-syntax">tell the wizard that she is an idiot.)</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">actor</span><span class="plain-syntax"> == </span><span class="identifier-syntax">player</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=2 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">num_words</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Conversation</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">NotConversation</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">NextWord nudges the word number wn on by one each time, so we've now</span>
<span class="plain-syntax">    </span><span class="comment-syntax">advanced past a comma.  (A comma is a word all on its own in the table.)</span>

<span class="plain-syntax">    .</span><span class="identifier-syntax">Conversation</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Use NounDomain (in the context of "animate creature") to see if the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">words make sense as the name of someone held or nearby</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">lookahead</span><span class="plain-syntax"> = </span><span class="identifier-syntax">HELD_TOKEN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TALKING_REASON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NounDomain</span><span class="plain-syntax">(</span><span class="identifier-syntax">player</span><span class="plain-syntax">, </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">, </span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PARSING_REASON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReParse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordMarkedAsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">)) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">NotConversation</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">MISSINGPERSON_PE</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    .</span><span class="identifier-syntax">Conversation2</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">The object addressed must at least be "talkable" if not actually "animate"</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(the distinction allows, for instance, a microphone to be spoken to,</span>
<span class="plain-syntax">    </span><span class="comment-syntax">without the parser thinking that the microphone is human).</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">animate</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">talkable</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ANIMALISTEN_PE</span><span class="plain-syntax">; </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Check that there aren't any mystery words between the end of the person's</span>
<span class="plain-syntax">    </span><span class="comment-syntax">name and the comma (eg, throw out "dwarf sdfgsdgs, go north").</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">j</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordMarkedAsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">)) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">NotConversation</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TOTALK_PE</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">The player has now successfully named someone.  Adjust "him", "her", "it":</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">PronounNotice</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Set the global variable "actor", adjust the number of the first word,</span>
<span class="plain-syntax">    </span><span class="comment-syntax">and begin parsing again from there.</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax"> = </span><span class="identifier-syntax">j</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Stop things like "me, again":</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">player</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">() == </span><span class="identifier-syntax">AGAIN1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AGAIN2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AGAIN3__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ANIMAAGAIN_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Actor is "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="string-syntax">" in "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">BeginCommand</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. Parser Letter D. </b>Get the verb: try all the syntax lines for that verb.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    .</span><span class="identifier-syntax">NotConversation</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordMarkedAsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">UnknownVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">VerbAccepted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VERB_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    .</span><span class="identifier-syntax">VerbAccepted</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">We now definitely have a verb, not a direction, whether we got here by the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">"take ..." or "person, take ..." method.</span>

<span class="plain-syntax">    </span><span class="comment-syntax">You can't order other people to "full score" for you, and so on...</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordMarkedAsMeta</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">) &amp;&amp; </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">player</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VERB_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">meta</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Now let i be the corresponding verb number...</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">DictionaryWordToVerbNum</span><span class="plain-syntax">(</span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">...then look up the i-th entry in the verb table, whose address is at word</span>
<span class="plain-syntax">    </span><span class="comment-syntax">7 in the Z-machine (in the header), so as to get the address of the syntax</span>
<span class="plain-syntax">    </span><span class="comment-syntax">table for the given verb...</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">TARGET_ZCODE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">syntax</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">HDR_STATICMEMORY</span><span class="plain-syntax">--&gt;0)--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">; </span><span class="comment-syntax">TARGET_GLULX</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">syntax</span><span class="plain-syntax"> = (#</span><span class="identifier-syntax">grammar_table</span><span class="plain-syntax">)--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">TARGET_</span>

<span class="plain-syntax">    </span><span class="comment-syntax">...and then see how many lines (ie, different patterns corresponding to the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">same verb) are stored in the parse table...</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">num_lines</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">syntax</span><span class="plain-syntax">-&gt;0) - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">...and now go through them all, one by one.</span>
<span class="plain-syntax">    </span><span class="comment-syntax">To prevent pronoun_word 0 being misunderstood,</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Parsing for the verb '"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">, </span><span class="string-syntax">"' ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">num_lines</span><span class="plain-syntax">+1, </span><span class="string-syntax">" lines)]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">; </span><span class="identifier-syntax">nextbest_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">multiflag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">"best_etype" is the current failure-to-match error - it is by default</span>
<span class="plain-syntax">    </span><span class="comment-syntax">the least informative one, "don't understand that sentence".</span>
<span class="plain-syntax">    </span><span class="comment-syntax">"nextbest_etype" remembers the best alternative to having to ask a</span>
<span class="plain-syntax">    </span><span class="comment-syntax">scope token for an error message (i.e., the best not counting ASKSCOPE_PE).</span>
<span class="plain-syntax">    </span><span class="comment-syntax">multiflag is used here to prevent inappropriate MULTI_PE errors</span>
<span class="plain-syntax">    </span><span class="comment-syntax">in addition to its unrelated duties passing information to action routines</span>
</pre>
<p class="commentary firstcommentary"><a id="SP17" class="paragraph-anchor"></a><b>&#167;17. Parser Letter E. </b>Break down a syntax line into analysed tokens.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> = </span><span class="identifier-syntax">syntax</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">line</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">num_lines</span><span class="plain-syntax"> : </span><span class="identifier-syntax">line</span><span class="plain-syntax">++) {</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Unpack the syntax line from Inform format into three arrays; ensure that</span>
<span class="plain-syntax">        </span><span class="comment-syntax">the sequence of tokens ends in an ENDIT_TOKEN.</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">line_address</span><span class="plain-syntax"> = </span><span class="identifier-syntax">UnpackGrammarLine</span><span class="plain-syntax">(</span><span class="identifier-syntax">line_address</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[line "</span><span class="plain-syntax">, </span><span class="identifier-syntax">line</span><span class="plain-syntax">; </span><span class="identifier-syntax">DebugGrammarLine</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">        </span><span class="comment-syntax">We aren't in "not holding" or inferring modes, and haven't entered</span>
<span class="plain-syntax">        </span><span class="comment-syntax">any parameters on the line yet, or any special numbers; the multiple</span>
<span class="plain-syntax">        </span><span class="comment-syntax">object is still empty.</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">nsns</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">special_word</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multi_context</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">; </span><span class="identifier-syntax">multi_had</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Put the word marker back to just after the verb</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">+1;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP18" class="paragraph-anchor"></a><b>&#167;18. Parser Letter F. </b>Look ahead for advance warning for <span class="extract"><span class="extract-syntax">multiexcept</span></span>/<span class="extract"><span class="extract-syntax">multiinside</span></span>.
</p>

<p class="commentary">There are two special cases where parsing a token now has to be affected by
the result of parsing another token later, and these two cases (multiexcept
and multiinside tokens) are helped by a quick look ahead, to work out the
future token now. We can only carry this out in the simple (but by far the
most common) case:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">multiexcept &lt;one or more prepositions&gt; noun</span>
and similarly for <span class="extract"><span class="extract-syntax">multiinside</span></span>.
<span class="plain-syntax">        </span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax"> = -1; </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0,</span><span class="identifier-syntax">m</span><span class="plain-syntax">=</span><span class="reserved-syntax">false</span><span class="plain-syntax">,</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax">) </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">  &amp;&amp; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="comment-syntax">First non-preposition is "multiexcept" or</span>
<span class="plain-syntax">                    </span><span class="comment-syntax">"multiinside", so look ahead.</span>

<span class="plain-syntax">                    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" [Trying look-ahead]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">                    </span><span class="comment-syntax">We need this to be followed by 1 or more prepositions.</span>

<span class="plain-syntax">                    </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="comment-syntax">skip ahead to a preposition word in the input</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">do</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                        } </span><span class="reserved-syntax">until</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                                 (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">l</span><span class="plain-syntax">-&gt;#</span><span class="identifier-syntax">dict_par1</span><span class="plain-syntax">) &amp; </span><span class="identifier-syntax">DICTPAR1_PREP</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">));</span>

<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" [Look-ahead aborted: prepositions missing]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">EmptyLine</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        }</span>

<span class="plain-syntax">                        </span><span class="reserved-syntax">do</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PrepositionChain</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">) ~= -1) {</span>
<span class="plain-syntax">                                </span><span class="comment-syntax">advance past the chain</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">)-&gt;0 &amp; </span><span class="constant-syntax">$20</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                                    </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                                    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                                           ((</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">)-&gt;0 &amp; </span><span class="constant-syntax">$10</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                                        </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                                } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                                    </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                                }</span>
<span class="plain-syntax">                            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                                </span><span class="comment-syntax">try to find another preposition word</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">do</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                                    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                                } </span><span class="reserved-syntax">until</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                                         (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">l</span><span class="plain-syntax">-&gt;#</span><span class="identifier-syntax">dict_par1</span><span class="plain-syntax">) &amp; </span><span class="identifier-syntax">DICTPAR1_PREP</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">));</span>

<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">l</span><span class="plain-syntax">-&gt;#</span><span class="identifier-syntax">dict_par1</span><span class="plain-syntax">) &amp; </span><span class="identifier-syntax">DICTPAR1_PREP</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>

<span class="plain-syntax">                                </span><span class="comment-syntax">lookahead failed</span>
<span class="plain-syntax">                                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                                    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" [Look-ahead aborted: prepositions don't match]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">LineFailed</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            }</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                        } </span><span class="reserved-syntax">until</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">);</span>

<span class="plain-syntax">                        .</span><span class="identifier-syntax">EmptyLine</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="comment-syntax">put back the non-preposition we just read</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>

<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                            (</span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOUN_TOKEN</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Descriptors</span><span class="plain-syntax">();  </span><span class="comment-syntax">skip past THE etc</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax">~=0) </span><span class="identifier-syntax">etype</span><span class="plain-syntax">=</span><span class="identifier-syntax">l</span><span class="plain-syntax">;  </span><span class="comment-syntax">don't allow multiple objects</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">parameters</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NounDomain</span><span class="plain-syntax">(</span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="identifier-syntax">NOUN_TOKEN</span><span class="plain-syntax">, </span><span class="reserved-syntax">true</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">parameters</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" [Advanced to ~noun~ token: "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"re-parse request]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"but multiple found]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"error "</span><span class="plain-syntax">, </span><span class="identifier-syntax">etype</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                }</span>
<span class="plain-syntax">                            }</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReParse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        }</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Slightly different line-parsing rules will apply to "take multi", to</span>
<span class="plain-syntax">        </span><span class="comment-syntax">prevent "take all" behaving correctly but misleadingly when there's</span>
<span class="plain-syntax">        </span><span class="comment-syntax">nothing to take.</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">params_wanted</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Take</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">And now start again, properly, forearmed or not as the case may be.</span>
<span class="plain-syntax">        </span><span class="comment-syntax">As a precaution, we clear all the variables again (they may have been</span>
<span class="plain-syntax">        </span><span class="comment-syntax">disturbed by the call to NounDomain, which may have called outside</span>
<span class="plain-syntax">        </span><span class="comment-syntax">code, which may have done anything!).</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">nsns</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">special_word</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">; </span><span class="identifier-syntax">multi_had</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">+1;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP19" class="paragraph-anchor"></a><b>&#167;19. Parser Letter G. </b>Parse each token in turn (calling <span class="extract"><span class="extract-syntax">ParseToken</span></span> to do most of the work).
</p>

<p class="commentary">The <span class="extract"><span class="extract-syntax">pattern</span></span> gradually accumulates what has been recognised so far,
so that it may be reprinted by the parser later on.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">        </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">=1 : : </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-1) == </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((((</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-2))-&gt;0) &amp; </span><span class="constant-syntax">$10</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">AnalyseToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-2));</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="reserved-syntax">true</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax"> == -1) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        }</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PrepositionChain</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-2) == -1) {</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[line rejected for not ending with correct preposition]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">                        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax">+1;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">) </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">=1 : : </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PATTERN_NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lookahead</span><span class="plain-syntax"> = </span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">" [line "</span><span class="plain-syntax">, </span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="string-syntax">" token "</span><span class="plain-syntax">, </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">, </span><span class="string-syntax">" word "</span><span class="plain-syntax">, </span><span class="identifier-syntax">wn</span><span class="plain-syntax">, </span><span class="string-syntax">" : "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">DebugToken</span><span class="plain-syntax">) </span><span class="identifier-syntax">token</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                  </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PARSING_REASON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">AnalyseToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">token</span><span class="plain-syntax">);</span>

<span class="plain-syntax">                </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ParseToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax">, </span><span class="identifier-syntax">found_tdata</span><span class="plain-syntax">, </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-1, </span><span class="identifier-syntax">token</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">GPR_NOUN</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &lt; -1)) </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ParseToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax">, </span><span class="identifier-syntax">l</span><span class="plain-syntax"> + </span><span class="constant-syntax">256</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PARSING_REASON</span><span class="plain-syntax">;</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax">~=</span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax">~=</span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax"> ||</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">found_tdata</span><span class="plain-syntax">~=</span><span class="identifier-syntax">TOPIC_TOKEN</span><span class="plain-syntax">)) </span><span class="identifier-syntax">params_wanted</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">GPR_REPARSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">GPR_NUMBER</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nsns</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">special_number1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">special_number2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="identifier-syntax">nsns</span><span class="plain-syntax">++; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            }</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">GPR_MULTIPLE</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">parameters</span><span class="plain-syntax">+</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">) = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">parameters</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        }</span>

<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [token resulted in "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"re-parse request]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"failure with error type "</span><span class="plain-syntax">, </span><span class="identifier-syntax">etype</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"success]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReParse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>

<span class="plain-syntax">                </span><span class="comment-syntax">If the player has entered enough already but there's still</span>
<span class="plain-syntax">                </span><span class="comment-syntax">text to wade through: store the pattern away so as to be able to produce</span>
<span class="plain-syntax">                </span><span class="comment-syntax">a decent error message if this turns out to be the best we ever manage,</span>
<span class="plain-syntax">                </span><span class="comment-syntax">and in the mean time give up on this line</span>

<span class="plain-syntax">                </span><span class="comment-syntax">However, if the superfluous text begins with a comma or "then" then</span>
<span class="plain-syntax">                </span><span class="comment-syntax">take that to be the start of another instruction</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">held_back_mode</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; </span><span class="identifier-syntax">hb_wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">-1;</span>
<span class="plain-syntax">                    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">&lt;32 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">++) </span><span class="identifier-syntax">pattern2</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">pcount2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">UPTO_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">                </span><span class="comment-syntax">Now, we may need to revise the multiple object because of the single one</span>
<span class="plain-syntax">                </span><span class="comment-syntax">we now know (but didn't when the list was drawn up).</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ReviseMulti</span><span class="plain-syntax">(</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ReviseMulti</span><span class="plain-syntax">(</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">                    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">l</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">multi_context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">k</span><span class="plain-syntax"> == </span><span class="identifier-syntax">l</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                                ((</span><span class="identifier-syntax">multi_context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="reserved-syntax">notin</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="reserved-syntax">notin</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                                </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOTHING_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            }</span>
<span class="plain-syntax">                        }</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">                </span><span class="comment-syntax">To trap the case of "take all" inferring only "yourself" when absolutely</span>
<span class="plain-syntax">                </span><span class="comment-syntax">nothing else is in the vicinity...</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOTHING_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">multi_had</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TOOFEW_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Line successfully parsed]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">                </span><span class="comment-syntax">The line has successfully matched the text.  Declare the input error-free...</span>

<span class="plain-syntax">                </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">                </span><span class="comment-syntax">...explain any inferences made (using the pattern)...</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">PrintInferredCommand</span><span class="plain-syntax">(</span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">ClearParagraphing</span><span class="plain-syntax">(20);</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">                </span><span class="comment-syntax">...copy the action number, and the number of parameters...</span>

<span class="plain-syntax">                </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">NO_INPS_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parameters</span><span class="plain-syntax">;</span>

<span class="plain-syntax">                </span><span class="comment-syntax">...reverse first and second parameters if need be...</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">action_reversed</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nsns</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">special_number1</span><span class="plain-syntax">; </span><span class="identifier-syntax">special_number1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">special_number2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">special_number2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">                </span><span class="comment-syntax">...and to reset "it"-style objects to the first of these parameters, if</span>
<span class="plain-syntax">                </span><span class="comment-syntax">there is one (and it really is an object)...</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">PronounNotice</span><span class="plain-syntax">(</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">);</span>

<span class="plain-syntax">                </span><span class="comment-syntax">...and return from the parser altogether, having successfully matched</span>
<span class="plain-syntax">                </span><span class="comment-syntax">a line.</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">held_back_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">wn</span><span class="plain-syntax">=</span><span class="identifier-syntax">hb_wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">LookForMore</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            } </span><span class="comment-syntax">end of if(token ~= ENDIT_TOKEN) else</span>
<span class="plain-syntax">        } </span><span class="comment-syntax">end of for(pcount++)</span>

<span class="plain-syntax">        .</span><span class="identifier-syntax">LineFailed</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="comment-syntax">The line has failed to match.</span>
<span class="plain-syntax">        </span><span class="comment-syntax">We continue the outer "for" loop, trying the next line in the grammar.</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax">) </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">etype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">ASKSCOPE_PE</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">nextbest_etype</span><span class="plain-syntax">) </span><span class="identifier-syntax">nextbest_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">etype</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">...unless the line was something like "take all" which failed because</span>
<span class="plain-syntax">        </span><span class="comment-syntax">nothing matched the "all", in which case we stop and give an error now.</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">etype</span><span class="plain-syntax">==</span><span class="identifier-syntax">NOTHING_PE</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    } </span><span class="comment-syntax">end of for(line++)</span>

<span class="plain-syntax">    </span><span class="comment-syntax">The grammar is exhausted: every line has failed to match.</span>
</pre>
<p class="commentary firstcommentary"><a id="SP20" class="paragraph-anchor"></a><b>&#167;20. Parser Letter H. </b>Cheaply parse otherwise unrecognised conversation and return.
</p>

<p class="commentary">(Errors are handled differently depending on who was talking. If the command
was addressed to somebody else (eg, DWARF, SFGH) then it is taken as
conversation which the parser has no business in disallowing.)
</p>

<p class="commentary">The parser used to return the fake action <span class="extract"><span class="extract-syntax">##NotUnderstood</span></span> when a
command in the form PERSON, ARFLE BARFLE GLOOP is parsed, where a character
is addressed but with an instruction which the parser can't understand.
(If a command such as ARFLE BARFLE GLOOP is not an instruction to someone
else, the parser prints an error and requires the player to type another
command: thus <span class="extract"><span class="extract-syntax">##NotUnderstood</span></span> was only returned when <span class="extract"><span class="extract-syntax">actor</span></span> is not the
player.) And I6 had elaborate object-oriented ways to deal with this, but we
won't use any of that: we simply convert to a <span class="extract"><span class="extract-syntax">##Answer</span></span> action, which
communicates a snippet of words to another character, just as if the
player had typed ANSWER ARFLE BARFLE GLOOP TO PERSON. For I7 purposes, the
fake action <span class="extract"><span class="extract-syntax">##NotUnderstood</span></span> does not exist.
</p>

<p class="commentary">In order to assist people who do want to parse that type of mistyped command
in extensions, wn is left pointing at the first word not parsed as a command.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">  .</span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">actor</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">player</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">usual_grammar_after</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax"> = </span><span class="identifier-syntax">usual_grammar_after</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">AlmostReParse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="comment-syntax">Save wn so extension authors can parse command errors if they want to</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">() ~= </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">)) ;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = ##</span><span class="identifier-syntax">Answer</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">NO_INPS_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax"> = </span><span class="identifier-syntax">actor</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">special_number1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">special_word</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">player</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">consult_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">consult_words</span><span class="plain-syntax"> = </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">-</span><span class="identifier-syntax">consult_from</span><span class="plain-syntax">+1;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">m</span><span class="plain-syntax">; </span><span class="comment-syntax">Restore wn so extension authors can parse command errors if they want to</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<p class="commentary firstcommentary"><a id="SP21" class="paragraph-anchor"></a><b>&#167;21. Parser Letter I. </b>Print best possible error message.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">If the player was the actor (eg, in "take dfghh") the error must be printed,</span>
<span class="plain-syntax">    </span><span class="comment-syntax">and fresh input called for.  In three cases the oops word must be jiggled.</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">String</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ParserError</span><span class="plain-syntax">(</span><span class="identifier-syntax">etype</span><span class="plain-syntax">) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReType</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verb_wordnum</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CANTSEE_PE</span><span class="plain-syntax">) </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VERB_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">players_command</span><span class="plain-syntax"> = </span><span class="constant-syntax">100</span><span class="plain-syntax"> + </span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">(); </span><span class="comment-syntax">The snippet variable "player's command"</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_PARSER_ERROR_ACT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_PARSER_ERROR_ACT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">SkipParserError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pronoun__word</span><span class="plain-syntax">; </span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pronoun__obj</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">) {    </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">UPTO_PE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">&lt;32 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">++) </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pattern2</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pcount2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inferred_go</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'C'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PrintCommand</span><span class="plain-syntax">(0);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">".^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NUMBER_PE</span><span class="plain-syntax">) {   </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'D'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CANTSEE_PE</span><span class="plain-syntax">) {  </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'E'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">=</span><span class="identifier-syntax">saved_oops</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TOOLIT_PE</span><span class="plain-syntax">) {   </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'F'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOTHELD_PE</span><span class="plain-syntax">) {  </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'G'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">=</span><span class="identifier-syntax">saved_oops</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_PE</span><span class="plain-syntax">) {    </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'H'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MMULTI_PE</span><span class="plain-syntax">) {   </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'I'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">VAGUE_PE</span><span class="plain-syntax">) {    </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'J'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ITGONE_PE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'J'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'K'</span><span class="plain-syntax">, </span><span class="identifier-syntax">noun</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">EXCEPT_PE</span><span class="plain-syntax">) {   </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'L'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ANIMA_PE</span><span class="plain-syntax">) {    </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'M'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">VERB_PE</span><span class="plain-syntax">) {     </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'N'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">SCENERY_PE</span><span class="plain-syntax">) {  </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'O'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">JUNKAFTER_PE</span><span class="plain-syntax">) {  </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'P'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TOOFEW_PE</span><span class="plain-syntax">) {  </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'Q'</span><span class="plain-syntax">, </span><span class="identifier-syntax">multi_had</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOTHING_PE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Remove</span><span class="plain-syntax"> &amp;&amp;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Object</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP2_PRES</span><span class="plain-syntax">; </span><span class="comment-syntax">ensure valid for messages</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">noun</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">animate</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_N_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'C'</span><span class="plain-syntax">, </span><span class="identifier-syntax">noun</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">noun</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">supporter</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_N_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'D'</span><span class="plain-syntax">, </span><span class="identifier-syntax">noun</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">noun</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">open</span><span class="plain-syntax">)  { </span><span class="identifier-syntax">PARSER_N_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'E'</span><span class="plain-syntax">, </span><span class="identifier-syntax">noun</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">children</span><span class="plain-syntax">(</span><span class="identifier-syntax">noun</span><span class="plain-syntax">)==0) { </span><span class="identifier-syntax">PARSER_N_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'F'</span><span class="plain-syntax">, </span><span class="identifier-syntax">noun</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">ACTION_PRES</span><span class="plain-syntax"> ~= ##</span><span class="identifier-syntax">Remove</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">multi_wanted</span><span class="plain-syntax">==100) { </span><span class="identifier-syntax">PARSER_N_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax">                  {  </span><span class="identifier-syntax">PARSER_N_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOTINCONTEXT_PE</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'R'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ANIMAAGAIN_PE</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'S'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">COMMABEGIN_PE</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'T'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MISSINGPERSON_PE</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'U'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ANIMALISTEN_PE</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'V'</span><span class="plain-syntax">, </span><span class="identifier-syntax">noun</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TOTALK_PE</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'W'</span><span class="plain-syntax">); </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ASKSCOPE_PE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">scope_stage</span><span class="plain-syntax"> = </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">scope_error</span><span class="plain-syntax">() == -1) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">nextbest_etype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (~~((</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">String</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_PARSER_ERROR_ACT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    .</span><span class="identifier-syntax">SkipParserError</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">String</span><span class="plain-syntax">)) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReType</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">say__p</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">PRINTING_A_PARSER_ERROR_ACT</span><span class="plain-syntax">);</span>
</pre>
<p class="commentary firstcommentary"><a id="SP22" class="paragraph-anchor"></a><b>&#167;22. Parser Letter J. </b>Retry the whole lot.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">And go (almost) right back to square one...</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ReType</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">...being careful not to go all the way back, to avoid infinite repetition</span>
<span class="plain-syntax">    </span><span class="comment-syntax">of a deferred command causing an error.</span>
</pre>
<p class="commentary firstcommentary"><a id="SP23" class="paragraph-anchor"></a><b>&#167;23. Parser Letter K. </b>Last thing: check for THEN and further instructions(s), return.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">At this point, the return value is all prepared, and we are only looking</span>
<span class="plain-syntax">    </span><span class="comment-syntax">to see if there is a "then" followed by subsequent instruction(s).</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">LookForMore</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">           </span><span class="identifier-syntax">held_back_mode</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">           </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">hb_wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">held_back_mode</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">       </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">UPTO_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">GiveError</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP24" class="paragraph-anchor"></a><b>&#167;24. End of Parser Proper. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">]; </span><span class="comment-syntax">end of Parser__parse</span>
</pre>
<p class="commentary firstcommentary"><a id="SP25" class="paragraph-anchor"></a><b>&#167;25. Internal Rule. </b>As a hook on which to hang responses.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">PARSER_ERROR_INTERNAL_R</span><span class="plain-syntax">; ];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">PARSER_N_ERROR_INTERNAL_R</span><span class="plain-syntax">; ];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">PARSER_COMMAND_INTERNAL_R</span><span class="plain-syntax">; ];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP26" class="paragraph-anchor"></a><b>&#167;26. Parse Token. </b>The main parsing routine above tried a sequence of "grammar lines" in turn,
matching each against the text typed until one fitted. A grammar line is
itself a sequence of "grammar tokens". Here we have to parse the tokens.
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">ParseToken(type, data)</span></span> tries the match text beginning at the current
word marker <span class="extract"><span class="extract-syntax">wn</span></span> against a token of the given <span class="extract"><span class="extract-syntax">type</span></span>, with the given <span class="extract"><span class="extract-syntax">data</span></span>.
The optional further arguments <span class="extract"><span class="extract-syntax">token_n</span></span> and <span class="extract"><span class="extract-syntax">token</span></span> supply the token
number in the current grammar line (because some tokens do depend on what
has happened before or is needed later) and the address of the dictionary
word which makes up the <span class="extract"><span class="extract-syntax">token</span></span>, in the case where it's a "preposition".
</p>

<p class="commentary">The return values are:
</p>

<ul class="items"><li>(a) <span class="extract"><span class="extract-syntax">GPR_REPARSE</span></span> for "I have rewritten the command, please re-parse from scratch";
</li><li>(b) <span class="extract"><span class="extract-syntax">GPR_PREPOSITION</span></span> for "token accepted with no result";
</li><li>(c) \(-256 + x\) for "please parse <span class="extract"><span class="extract-syntax">ParseToken(ELEMENTARY_TT, x)</span></span> instead";
</li><li>(d) <span class="extract"><span class="extract-syntax">GPR_MULTIPLE</span></span> for "token accepted, result is the multiple object list";
</li><li>(e) 1 for "token accepted, result is the number in <span class="extract"><span class="extract-syntax">parsed_number</span></span>";
</li><li>(f) an object number for "token accepted with this object as result";
</li><li>(g) \(-1\) for "token rejected".
</li></ul>
<p class="commentary">Strictly speaking <span class="extract"><span class="extract-syntax">ParseToken</span></span> is a shell routine which saves the current
state on the stack, and calling <span class="extract"><span class="extract-syntax">ParseToken__</span></span> to do the actual work.
</p>

<p class="commentary">Once again the routine is traditionally divided into six letters, here named under
paragraphs "Parse Token Letter A", and so on.
</p>

<ul class="items"><li>(A) Analyse the token; handle all tokens not involving object lists and
break down others into elementary tokens
</li><li>(B) Begin parsing an object list
</li><li>(C) Parse descriptors (articles, pronouns, etc.) in the list
</li><li>(D) Parse an object name
</li><li>(E) Parse connectives (AND, BUT, etc.) and go back to (C)
</li><li>(F) Return the conclusion of parsing an object list
</li></ul>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ParseTokenStopped</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="identifier-syntax">y</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax">&gt;</span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">()) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ParseToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax">,</span><span class="identifier-syntax">y</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>

<span class="identifier-syntax">Global</span><span class="plain-syntax"> </span><span class="identifier-syntax">parsetoken_nesting</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">ParseToken</span><span class="plain-syntax"> </span><span class="identifier-syntax">given_ttype</span><span class="plain-syntax"> </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_n</span><span class="plain-syntax"> </span><span class="identifier-syntax">token</span><span class="plain-syntax">  </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parsetoken_nesting</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">save match globals</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">;</span>
<span class="plain-syntax">     }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">parsetoken_nesting</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ParseToken__</span><span class="plain-syntax">(</span><span class="identifier-syntax">given_ttype</span><span class="plain-syntax">, </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_n</span><span class="plain-syntax">, </span><span class="identifier-syntax">token</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parsetoken_nesting</span><span class="plain-syntax">--;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parsetoken_nesting</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">restore match globals</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">-1: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;=0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">--) {</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">; </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">; </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">; </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ParseToken__</span><span class="plain-syntax"> </span><span class="identifier-syntax">given_ttype</span><span class="plain-syntax"> </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_n</span><span class="plain-syntax"> </span><span class="identifier-syntax">token</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">and_parity</span><span class="plain-syntax"> </span><span class="identifier-syntax">single_object</span><span class="plain-syntax"> </span><span class="identifier-syntax">desc_wn</span><span class="plain-syntax"> </span><span class="identifier-syntax">many_flag</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">token_allows_multiple</span><span class="plain-syntax"> </span><span class="identifier-syntax">prev_indef_wanted</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP27" class="paragraph-anchor"></a><b>&#167;27. Parse Token Letter A. </b>Analyse token; handle all not involving object lists, break down others.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_inflection</span><span class="plain-syntax"> = </span><span class="identifier-syntax">name</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">given_ttype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">      </span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax">:</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">          </span><span class="identifier-syntax">SPECIAL_TOKEN</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TryNumber</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">special_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= -1000)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Read special as the number "</span><span class="plain-syntax">, </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == -1000) {</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Read special word at word number "</span><span class="plain-syntax">, </span><span class="identifier-syntax">wn</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">special_word</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_NUMBER</span><span class="plain-syntax">;</span>

<span class="plain-syntax">          </span><span class="identifier-syntax">NUMBER_TOKEN</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax">=</span><span class="identifier-syntax">TryNumber</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">++);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == -1000) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NUMBER_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax">&gt;=3) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Read number as "</span><span class="plain-syntax">, </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_NUMBER</span><span class="plain-syntax">;</span>

<span class="plain-syntax">          </span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Answer</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Ask</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">AskFor</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Tell</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TALKING_REASON</span><span class="plain-syntax">;</span>

<span class="plain-syntax">          </span><span class="identifier-syntax">TOPIC_TOKEN</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">consult_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">token_n</span><span class="plain-syntax">+1) ~= </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">               (</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">token_n</span><span class="plain-syntax">+1) ~= </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"ComplicatedUnderstandTextToken"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="string-syntax">"This use of '[text]' is too complicated."</span><span class="plain-syntax">, </span><span class="identifier-syntax">WorldModelKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">do</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">until</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == -1 || </span><span class="identifier-syntax">PrepositionChain</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_n</span><span class="plain-syntax">+1) ~= -1);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">consult_words</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">-</span><span class="identifier-syntax">consult_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">consult_words</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Ask</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Answer</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Tell</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">consult_from</span><span class="plain-syntax">; </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax">==-1 &amp;&amp; (</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">token_n</span><span class="plain-syntax">+1) == </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;    </span><span class="comment-syntax">don't infer if required preposition is absent</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">      </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">:</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax">&gt;=5) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Preposition token]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Is it an unnecessary alternative preposition, when a previous choice</span>
<span class="plain-syntax">        </span><span class="comment-syntax">has already been matched?</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;0) &amp; </span><span class="constant-syntax">$10</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">If we've run out of the player's input, but still have parameters to</span>
<span class="plain-syntax">        </span><span class="comment-syntax">specify, we go into "infer" mode, remembering where we are and the</span>
<span class="plain-syntax">        </span><span class="comment-syntax">preposition we are inferring...</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax">==0 &amp;&amp; </span><span class="identifier-syntax">parameters</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">params_wanted</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">; </span><span class="identifier-syntax">inferword</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax"> + </span><span class="identifier-syntax">VM_DictionaryAddressToNumber</span><span class="plain-syntax">(</span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            </span><span class="comment-syntax">If we are not inferring, then the line is wrong...</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>

<span class="plain-syntax">            </span><span class="comment-syntax">If not, then the line is right but we mark in the preposition...</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax"> + </span><span class="identifier-syntax">VM_DictionaryAddressToNumber</span><span class="plain-syntax">(</span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax"> + </span><span class="identifier-syntax">VM_DictionaryAddressToNumber</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        </span><span class="comment-syntax">Whereas, if the player has typed something here, see if it is the</span>
<span class="plain-syntax">        </span><span class="comment-syntax">required preposition... if it's wrong, the line must be wrong,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">but if it's right, the token is passed (jump to finish this token).</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PrepositionChain</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_n</span><span class="plain-syntax">) ~= -1) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>

<span class="plain-syntax">      </span><span class="identifier-syntax">GPR_TT</span><span class="plain-syntax">:</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Outside parsing routine returned "</span><span class="plain-syntax">, </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>

<span class="plain-syntax">      </span><span class="identifier-syntax">SCOPE_TT</span><span class="plain-syntax">:</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">scope_stage</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Scope routine called at stage 1]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Scope routine returned multiple-flag of "</span><span class="plain-syntax">, </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax"> = </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOUN_TOKEN</span><span class="plain-syntax">;</span>

<span class="plain-syntax">      </span><span class="identifier-syntax">ATTR_FILTER_TT</span><span class="plain-syntax">:</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOUN_TOKEN</span><span class="plain-syntax">;</span>

<span class="plain-syntax">      </span><span class="identifier-syntax">ROUTINE_FILTER_TT</span><span class="plain-syntax">:</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOUN_TOKEN</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    } </span><span class="comment-syntax">end of switch(given_ttype)</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">given_tdata</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP28" class="paragraph-anchor"></a><b>&#167;28. Parse Token Letter B. </b>Begin parsing an object list.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">There are now three possible ways we can be here:</span>
<span class="plain-syntax">    </span><span class="comment-syntax">    parsing an elementary token other than "special" or "number";</span>
<span class="plain-syntax">    </span><span class="comment-syntax">    parsing a scope token;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">    parsing a noun-filter token (either by routine or attribute).</span>
<span class="plain-syntax">    </span>
<span class="plain-syntax">    </span><span class="comment-syntax">In each case, token holds the type of elementary parse to</span>
<span class="plain-syntax">    </span><span class="comment-syntax">perform in matching one or more objects, and</span>
<span class="plain-syntax">    </span><span class="comment-syntax">token_filter is 0 (default), an attribute + 1 for an attribute filter</span>
<span class="plain-syntax">    </span><span class="comment-syntax">or a routine address for a routine filter.</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">token_allows_multiple</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIHELD_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">token_allows_multiple</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">many_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">; </span><span class="identifier-syntax">and_parity</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; </span><span class="identifier-syntax">dont_infer</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">; </span><span class="identifier-syntax">dont_infer_pronoun</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP29" class="paragraph-anchor"></a><b>&#167;29. Parse Token Letter C. </b>Parse descriptors (articles, pronouns, etc.) in the list.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">We expect to find a list of objects next in what the player's typed.</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">ObjectList</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Object list from word "</span><span class="plain-syntax">, </span><span class="identifier-syntax">wn</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Take an advance look at the next word: if it's "it" or "them", and these</span>
<span class="plain-syntax">    </span><span class="comment-syntax">are unset, set the appropriate error number and give up on the line</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(if not, these are still parsed in the usual way - it is not assumed</span>
<span class="plain-syntax">    </span><span class="comment-syntax">that they still refer to something in scope)</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">(); </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PronounValue</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o</span><span class="plain-syntax">; </span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="comment-syntax">Don't assume this is a use of an unset pronoun until the</span>
<span class="plain-syntax">            </span><span class="comment-syntax">descriptors have been checked, because it might be an</span>
<span class="plain-syntax">            </span><span class="comment-syntax">article (or some such) instead</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">l</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">l</span><span class="plain-syntax">=</span><span class="identifier-syntax">l</span><span class="plain-syntax">+4)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">l</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">AssumeDescriptor</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pronoun__word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax">; </span><span class="identifier-syntax">pronoun__obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VAGUE_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Stop: unset pronoun]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">AssumeDescriptor</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ME1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ME2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ME3__WD</span><span class="plain-syntax">) { </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o</span><span class="plain-syntax">; </span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">player</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">allow_plurals</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; </span><span class="identifier-syntax">desc_wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">TryAgain</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">First, we parse any descriptive words (like "the", "five" or "every"):</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Descriptors</span><span class="plain-syntax">(</span><span class="identifier-syntax">token_allows_multiple</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">TryAgain2</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP30" class="paragraph-anchor"></a><b>&#167;30. Parse Token Letter D. </b>Parse an object name.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">This is an actual specified object, and is therefore where a typing error</span>
<span class="plain-syntax">    </span><span class="comment-syntax">is most likely to occur, so we set:</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">oops_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">So, two cases.  Case 1: token not equal to "held" (so, no implicit takes)</span>
<span class="plain-syntax">    </span><span class="comment-syntax">but we may well be dealing with multiple objects</span>

<span class="plain-syntax">    </span><span class="comment-syntax">In either case below we use NounDomain, giving it the token number as</span>
<span class="plain-syntax">    </span><span class="comment-syntax">context, and two places to look: among the actor's possessions, and in the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">present location.  (Note that the order depends on which is likeliest.)</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">HELD_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Calling NounDomain on location and actor]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NounDomain</span><span class="plain-syntax">(</span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="identifier-syntax">token</span><span class="plain-syntax">, </span><span class="identifier-syntax">dont_ask_for_clarification</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">;                  </span><span class="comment-syntax">Reparse after Q&amp;A</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> == </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;  </span><span class="comment-syntax">ReviseMulti if TAKE ALL FROM empty container</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_allows_multiple</span><span class="plain-syntax"> &amp;&amp; ~~</span><span class="identifier-syntax">multiflag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">best_etype</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTI_PE</span><span class="plain-syntax">) </span><span class="identifier-syntax">best_etype</span><span class="plain-syntax">=</span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multiflag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ResetDescriptors</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">desc_wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">TryAgain2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_PE</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">multiflag</span><span class="plain-syntax">) </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STUCK_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">etype</span><span class="plain-syntax">=</span><span class="identifier-syntax">CantSee</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">FailToken</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="comment-syntax">Choose best error</span>

<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [ND returned "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [ND appended to the multiple object list:^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">k</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  Entry "</span><span class="plain-syntax">, </span><span class="identifier-syntax">j</span><span class="plain-syntax">, </span><span class="string-syntax">": "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">The</span><span class="plain-syntax">) </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                          </span><span class="string-syntax">" ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">, </span><span class="string-syntax">")^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  List now has size "</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (~~</span><span class="identifier-syntax">many_flag</span><span class="plain-syntax">) </span><span class="identifier-syntax">many_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {                                </span><span class="comment-syntax">Merge with earlier ones</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;            </span><span class="comment-syntax">(with either parity)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">k</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">and_parity</span><span class="plain-syntax">) </span><span class="identifier-syntax">MultiAdd</span><span class="plain-syntax">(</span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">else</span><span class="plain-syntax">            </span><span class="identifier-syntax">MultiSub</span><span class="plain-syntax">(</span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Merging "</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">-</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">" new objects to the "</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">" old ones]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="comment-syntax">A single object was indeed found</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_length</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="comment-syntax">So the answer had to be inferred from no textual data,</span>
<span class="plain-syntax">                </span><span class="comment-syntax">and we know that there was an ambiguity in the descriptor</span>
<span class="plain-syntax">                </span><span class="comment-syntax">stage (such as a word which could be a pronoun being</span>
<span class="plain-syntax">                </span><span class="comment-syntax">parsed as an article or possessive).  It's worth having</span>
<span class="plain-syntax">                </span><span class="comment-syntax">another go.</span>

<span class="plain-syntax">                </span><span class="identifier-syntax">ResetDescriptors</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">desc_wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">TryAgain2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">token</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">CreatureTest</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ANIMA_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">FailToken</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="comment-syntax"> Animation is required</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (~~</span><span class="identifier-syntax">many_flag</span><span class="plain-syntax">) </span><span class="identifier-syntax">single_object</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">and_parity</span><span class="plain-syntax">) </span><span class="identifier-syntax">MultiAdd</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">MultiSub</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Combining "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">" with list]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Case 2: token is "held" (which fortunately can't take multiple objects)</span>
<span class="plain-syntax">    </span><span class="comment-syntax">and may generate an implicit take</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NounDomain</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">,</span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">,</span><span class="identifier-syntax">token</span><span class="plain-syntax">,</span><span class="identifier-syntax">dont_ask_for_clarification</span><span class="plain-syntax">);       </span><span class="comment-syntax">Same as above...</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ResetDescriptors</span><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">desc_wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">TryAgain2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CantSee</span><span class="plain-syntax">(); </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">FailToken</span><span class="plain-syntax">;            </span><span class="comment-syntax">Choose best error</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="comment-syntax">...until it produces something not held by the actor.  Then an implicit</span>
<span class="plain-syntax">        </span><span class="comment-syntax">take must be tried.  If this is already happening anyway, things are too</span>
<span class="plain-syntax">        </span><span class="comment-syntax">confused and we have to give up (but saving the oops marker so as to get</span>
<span class="plain-syntax">        </span><span class="comment-syntax">it on the right word afterwards).</span>
<span class="plain-syntax">        </span><span class="comment-syntax">The point of this last rule is that a sequence like</span>
<span class="plain-syntax">        </span>
<span class="plain-syntax">        </span><span class="comment-syntax">    &gt; read newspaper</span>
<span class="plain-syntax">        </span><span class="comment-syntax">    (taking the newspaper first)</span>
<span class="plain-syntax">        </span><span class="comment-syntax">    The dwarf unexpectedly prevents you from taking the newspaper!</span>
<span class="plain-syntax">        </span>
<span class="plain-syntax">        </span><span class="comment-syntax">should not be allowed to go into an infinite repeat - read becomes</span>
<span class="plain-syntax">        </span><span class="comment-syntax">take then read, but take has no effect, so read becomes take then read...</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Anyway for now all we do is record the number of the object to take.</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">l</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Allowing object "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="string-syntax">" for now]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">single_object</span><span class="plain-syntax"> = </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="comment-syntax">end of if (token ~= HELD_TOKEN) else</span>

<span class="plain-syntax">    </span><span class="comment-syntax">The following moves the word marker to just past the named object...</span>

<span class="comment-syntax">if (match_from ~= oops_from) print match_from, " vs ", oops_from, "^";</span>

<span class="comment-syntax">   wn = oops_from + match_length;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> + </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP31" class="paragraph-anchor"></a><b>&#167;31. Parse Token Letter E. </b>Parse connectives (AND, BUT, etc.) and go back to (C).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">Object(s) specified now: is that the end of the list, or have we reached</span>
<span class="plain-syntax">    </span><span class="comment-syntax">"and", "but" and so on?  If so, create a multiple-object list if we</span>
<span class="plain-syntax">    </span><span class="comment-syntax">haven't already (and are allowed to).</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">NextInList</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">AND1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AND2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AND3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">) {</span>

<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Read connective '"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">o</span><span class="plain-syntax">, </span><span class="string-syntax">"']^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (~~</span><span class="identifier-syntax">token_allows_multiple</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">multiflag</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">PassToken</span><span class="plain-syntax">; </span><span class="comment-syntax">give UPTO_PE error</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">etype</span><span class="plain-syntax">=</span><span class="identifier-syntax">MULTI_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">FailToken</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">BUT1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT3__WD</span><span class="plain-syntax">) </span><span class="identifier-syntax">and_parity</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">-</span><span class="identifier-syntax">and_parity</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (~~</span><span class="identifier-syntax">many_flag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;1 = </span><span class="identifier-syntax">single_object</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">many_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Making new list from "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">single_object</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dont_infer</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; </span><span class="identifier-syntax">dont_infer_pronoun</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">; </span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax">=0; </span><span class="comment-syntax">Don't print (inferences)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">ObjectList</span><span class="plain-syntax">; </span><span class="comment-syntax">And back around</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;   </span><span class="comment-syntax">Word marker back to first not-understood word</span>
</pre>
<p class="commentary firstcommentary"><a id="SP32" class="paragraph-anchor"></a><b>&#167;32. Parse Token Letter F. </b>Return the conclusion of parsing an object list.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="comment-syntax">Happy or unhappy endings:</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">PassToken</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">many_flag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">single_object</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GPR_MULTIPLE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multi_context</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">) </span><span class="identifier-syntax">multi_context</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">multi_had</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">multi_wanted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Too few found at letter F^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">               </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">FailToken</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">single_object</span><span class="plain-syntax">;</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">FailToken</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If we were only guessing about it being a plural, try again but only</span>
<span class="plain-syntax">    </span><span class="comment-syntax">allowing singulars (so that words like "six" are not swallowed up as</span>
<span class="plain-syntax">    </span><span class="comment-syntax">Descriptors)</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">allow_plurals</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_guess_p</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   [Retrying singulars after failure "</span><span class="plain-syntax">, </span><span class="identifier-syntax">etype</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prev_indef_wanted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">allow_plurals</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">desc_wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">TryAgain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax"> || </span><span class="identifier-syntax">prev_indef_wanted</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (~~</span><span class="identifier-syntax">multiflag</span><span class="plain-syntax">)) </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">MULTI_PE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">]; </span><span class="comment-syntax">end of ParseToken__</span>
</pre>
<p class="commentary firstcommentary"><a id="SP33" class="paragraph-anchor"></a><b>&#167;33. Descriptors. </b>In grammatical terms, a descriptor appears at the front of an English noun
phrase and clarifies the quantity or specific identity of what is referred
to: for instance, {\it my} mirror, {\it the} dwarf, {\it that} woman.
(Numbers, as in {\it four} duets, are also descriptors in linguistics:
but the I6 parser doesn't handle them that way.)
</p>

<p class="commentary">Slightly unfortunately, the bitmap constants used for descriptors in the
I6 parser have names in the form <span class="extract"><span class="extract-syntax">*_BIT</span></span>, coinciding with the names of
style bits in the list-writer: but they never occur in the same context.
</p>

<p class="commentary">The actual words used as descriptors are read from tables in the language
definition. <span class="extract"><span class="extract-syntax">ArticleDescriptors</span></span> uses this table to move current word
marker past a run of one or more descriptors which refer to the definite
or indefinite article.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">OTHER_BIT</span><span class="plain-syntax">  =   </span><span class="constant-syntax">1</span><span class="plain-syntax">;     </span><span class="comment-syntax"> These will be used in Adjudicate()</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">MY_BIT</span><span class="plain-syntax">     =   </span><span class="constant-syntax">2</span><span class="plain-syntax">;     </span><span class="comment-syntax"> to disambiguate choices</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">THAT_BIT</span><span class="plain-syntax">   =   </span><span class="constant-syntax">4</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax"> =   </span><span class="constant-syntax">8</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">LIT_BIT</span><span class="plain-syntax">    =  </span><span class="constant-syntax">16</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">UNLIT_BIT</span><span class="plain-syntax">  =  </span><span class="constant-syntax">32</span><span class="plain-syntax">;</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ResetDescriptors</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_guess_p</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> = </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax"> = </span><span class="constant-syntax">$$111111111111</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ArticleDescriptors</span><span class="plain-syntax">  </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> </span><span class="identifier-syntax">cto</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax">=</span><span class="reserved-syntax">true</span><span class="plain-syntax"> : </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> :) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">(); </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>

<span class="plain-syntax">       </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x</span><span class="plain-syntax">+4)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">x</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+2);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type</span><span class="plain-syntax"> == </span><span class="identifier-syntax">DEFART_PK</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">INDEFART_PK</span><span class="plain-syntax">) </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP34" class="paragraph-anchor"></a><b>&#167;34. Parsing Descriptors. </b>The <span class="extract"><span class="extract-syntax">Descriptors()</span></span> routine parses the descriptors at the head of a noun
phrase, leaving the current word marker <span class="extract"><span class="extract-syntax">wn</span></span> at the first word of the
noun phrase's body. It is allowed to set up for a plural only if <span class="extract"><span class="extract-syntax">allow_p</span></span>
is set; it returns a parser error number, or 0 if no error occurred.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">Descriptors</span><span class="plain-syntax">  </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> </span><span class="identifier-syntax">cto</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ResetDescriptors</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax">=</span><span class="reserved-syntax">true</span><span class="plain-syntax"> : </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> :) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">(); </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>

<span class="plain-syntax">       </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x</span><span class="plain-syntax">+4)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">x</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+2);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">DEFART_PK</span><span class="plain-syntax">) </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax"> &amp; (</span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+1));</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type</span><span class="plain-syntax"> == </span><span class="identifier-syntax">POSSESS_PK</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">cto</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageDescriptors</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+3);</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cto</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                      </span><span class="constant-syntax">0</span><span class="plain-syntax">: </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">MY_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                      </span><span class="constant-syntax">1</span><span class="plain-syntax">: </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">THAT_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                      </span><span class="reserved-syntax">default</span><span class="plain-syntax">:</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PronounValue</span><span class="plain-syntax">(</span><span class="identifier-syntax">cto</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> = </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type</span><span class="plain-syntax"> == </span><span class="identifier-syntax">LIGHTED_PK</span><span class="plain-syntax">)  </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">LIT_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type</span><span class="plain-syntax"> == </span><span class="identifier-syntax">UNLIGHTED_PK</span><span class="plain-syntax">) </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">UNLIT_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">OTHER1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">OTHER2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">OTHER3__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">OTHER_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ALL1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL4__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL5__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">allow_plurals</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">() ~= -1 </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax">) { </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--; </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TryNumber</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">-1); } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> { </span><span class="identifier-syntax">n</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) { </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">indef_guess_p</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">-1;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">() ~= </span><span class="identifier-syntax">OF1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">OF2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">OF3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">OF4__WD</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;  </span><span class="comment-syntax">Skip 'of' after these</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">SafeSkipDescriptors</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_guess_p</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Descriptors</span><span class="plain-syntax">();</span>

<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_possambig</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_guess_p</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP35" class="paragraph-anchor"></a><b>&#167;35. Preposition Chain. </b>A small utility for runs of prepositions.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">PrepositionChain</span><span class="plain-syntax"> </span><span class="identifier-syntax">wd</span><span class="plain-syntax"> </span><span class="identifier-syntax">index</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">index</span><span class="plain-syntax"> == </span><span class="identifier-syntax">wd</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">wd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">index</span><span class="plain-syntax">)-&gt;0 &amp; </span><span class="constant-syntax">$20</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">do</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">index</span><span class="plain-syntax"> == </span><span class="identifier-syntax">wd</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">wd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">index</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">until</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">index</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">) || (((</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">index</span><span class="plain-syntax">)-&gt;0 &amp; </span><span class="constant-syntax">$10</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP36" class="paragraph-anchor"></a><b>&#167;36. Creature. </b>Will this object do for an I6 <span class="extract"><span class="extract-syntax">creature</span></span> token? (In I7 terms, this affects
the tokens "[someone]", "[somebody]", "[anyone]" and "[anybody]".)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">CreatureTest</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">animate</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">talkable</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Ask</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Answer</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Tell</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">AskFor</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP37" class="paragraph-anchor"></a><b>&#167;37. Noun Domain. </b><span class="extract"><span class="extract-syntax">NounDomain</span></span> does the most substantial part of parsing an object name.
It is given two "domains" &mdash; usually a location and then the actor who is
looking &mdash; and a context (i.e. token type), and returns:
</p>

<ul class="items"><li>(a) 0 if no match at all could be made,
</li><li>(b) 1 if a multiple object was made,
</li><li>(c) \(k\) if object \(k\) was the one decided upon,
</li><li>(d) <span class="extract"><span class="extract-syntax">REPARSE_CODE</span></span> if it asked a question of the player and consequently
rewrote the player's input, so that the whole parser should start again
on the rewritten input.
</li></ul>
<p class="commentary">In case (c), <span class="extract"><span class="extract-syntax">NounDomain</span></span> also sets the variable <span class="extract"><span class="extract-syntax">length_of_noun</span></span> to the
number of words in the input text matched to the noun. In case (b),
the multiple objects are added to <span class="extract"><span class="extract-syntax">multiple_object</span></span> by hand (not by <span class="extract"><span class="extract-syntax">MultiAdd</span></span>,
because we want to allow duplicates).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">NounDomain</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain1</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain2</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax"> </span><span class="identifier-syntax">dont_ask</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">first_word</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">answer_words</span><span class="plain-syntax"> </span><span class="identifier-syntax">marker</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   [NounDomain called at word "</span><span class="plain-syntax">, </span><span class="identifier-syntax">wn</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">" (domain1 "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">domain1</span><span class="plain-syntax">, </span><span class="string-syntax">", domain2 "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">domain2</span><span class="plain-syntax">, </span><span class="string-syntax">")^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"seeking indefinite object: "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">OTHER_BIT</span><span class="plain-syntax">)  </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"other "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">MY_BIT</span><span class="plain-syntax">)     </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"my "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">THAT_BIT</span><span class="plain-syntax">)   </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"that "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"plural "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">LIT_BIT</span><span class="plain-syntax">)    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"lit "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">UNLIT_BIT</span><span class="plain-syntax">)  </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"unlit "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"owner:"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   number wanted: "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> == </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"all"</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   most likely GNAs of names: "</span><span class="plain-syntax">, </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"seeking definite object^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">match_length</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">SearchScope</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain1</span><span class="plain-syntax">, </span><span class="identifier-syntax">domain2</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   [ND made "</span><span class="plain-syntax">, </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">, </span><span class="string-syntax">" matches]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">+</span><span class="identifier-syntax">match_length</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If nothing worked at all, leave with the word marker skipped past the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">first unmatched word...</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">wn</span><span class="plain-syntax">++; </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Suppose that there really were some words being parsed (i.e., we did</span>
<span class="plain-syntax">    </span><span class="comment-syntax">not just infer).  If so, and if there was only one match, it must be</span>
<span class="plain-syntax">    </span><span class="comment-syntax">right and we return it...</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="comment-syntax">...now suppose that there was more typing to come, i.e. suppose that</span>
<span class="plain-syntax">        </span><span class="comment-syntax">the user entered something beyond this noun.  If nothing ought to follow,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">then there must be a mistake, (unless what does follow is just a full</span>
<span class="plain-syntax">        </span><span class="comment-syntax">stop, and or comma)</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">(); </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> ~=  </span><span class="identifier-syntax">AND1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AND2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">AND3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">comma_word</span>
<span class="plain-syntax">                   </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN3__WD</span>
<span class="plain-syntax">                   </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUT3__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lookahead</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Now look for a good choice, if there's more than one choice...</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIHELD_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">NOUN_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">HELD_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">                    (</span><span class="identifier-syntax">RulebookFailed</span><span class="plain-syntax">())) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">-1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Identical</span><span class="plain-syntax">(</span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">, </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">j</span><span class="plain-syntax">+1)) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">) </span><span class="identifier-syntax">dont_infer</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Adjudicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == -1) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;   </span><span class="comment-syntax"> Adjudicate has made a multiple</span>
<span class="plain-syntax">                             </span><span class="comment-syntax"> object, and we pass it on</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dont_infer_pronoun</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; </span><span class="comment-syntax">See bug I7-2115 for discussion of this</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If i is non-zero here, one of two things is happening: either</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(a) an inference has been successfully made that object i is</span>
<span class="plain-syntax">    </span><span class="comment-syntax">    the intended one from the user's specification, or</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(b) the user finished typing some time ago, but we've decided</span>
<span class="plain-syntax">    </span><span class="comment-syntax">    on i because it's the only possible choice.</span>
<span class="plain-syntax">    </span><span class="comment-syntax">In either case we have to keep the pattern up to date,</span>
<span class="plain-syntax">    </span><span class="comment-syntax">note that an inference has been made and return.</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(Except, we don't note which of a pile of identical objects.)</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dont_infer</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax">=</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dont_ask</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;0;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If we get here, there was no obvious choice of object to make.  If in</span>
<span class="plain-syntax">    </span><span class="comment-syntax">fact we've already gone past the end of the player's typing (which</span>
<span class="plain-syntax">    </span><span class="comment-syntax">means the match list must contain every object in scope, regardless</span>
<span class="plain-syntax">    </span><span class="comment-syntax">of its name), then it's foolish to give an enormous list to choose</span>
<span class="plain-syntax">    </span><span class="comment-syntax">from - instead we go and ask a more suitable question...</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Incomplete</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Now we print up the question, using the equivalence classes as worked</span>
<span class="plain-syntax">    </span><span class="comment-syntax">out by Adjudicate() so as not to repeat ourselves on plural objects...</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">ASKING_WHICH_DO_YOU_MEAN_ACT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">ASKING_WHICH_DO_YOU_MEAN_ACT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">SkipWhichQuestion</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">marker</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">marker</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">i</span><span class="plain-syntax">) &amp;&amp; ((</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">marker</span><span class="plain-syntax">) ~= -</span><span class="identifier-syntax">i</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">marker</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">marker</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">animate</span><span class="plain-syntax">) </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">) </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'B'</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax">; </span><span class="identifier-syntax">marker</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">marker</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">i</span><span class="plain-syntax">) &amp;&amp; ((</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">marker</span><span class="plain-syntax">) ~= -</span><span class="identifier-syntax">i</span><span class="plain-syntax">)) </span><span class="identifier-syntax">marker</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">marker</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">marker</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">k</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">a</span><span class="plain-syntax">) </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">j</span><span class="plain-syntax">-1)  </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">", "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">j</span><span class="plain-syntax">-1) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">`</span><span class="identifier-syntax">SERIAL_COMMA_CFGF</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">","</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'H'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"?^"</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    .</span><span class="identifier-syntax">SkipWhichQuestion</span><span class="plain-syntax">; </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">ASKING_WHICH_DO_YOU_MEAN_ACT</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">...and get an answer:</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">WhichOne</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=2 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">answer_words</span><span class="plain-syntax">=</span><span class="identifier-syntax">Keyboard</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Conveniently, parse2--&gt;1 is the first word in both ZCODE and GLULX.</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">first_word</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Take care of "all", because that does something too clever here to do</span>
<span class="plain-syntax">    </span><span class="comment-syntax">later on:</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first_word</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ALL1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL4__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL5__WD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIHELD_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">l</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1+</span><span class="identifier-syntax">l</span><span class="plain-syntax">) = </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'C'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">WhichOne</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Look for a comma, and interpret this as a fresh conversation command</span>
<span class="plain-syntax">    </span><span class="comment-syntax">if so:</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">answer_words</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordFrom</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">) == </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">VM_CopyBuffer</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">RECONSTRUCT_INPUT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If the first word of the reply can be interpreted as a verb, then</span>
<span class="plain-syntax">    </span><span class="comment-syntax">assume that the player has ignored the question and given a new</span>
<span class="plain-syntax">    </span><span class="comment-syntax">command altogether.</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(This is one time when it's convenient that the directions are</span>
<span class="plain-syntax">    </span><span class="comment-syntax">not themselves verbs - thus, "north" as a reply to "Which, the north</span>
<span class="plain-syntax">    </span><span class="comment-syntax">or south door" is not treated as a fresh command but as an answer.)</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first_word</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">first_word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageIsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">WordMarkedAsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_word</span><span class="plain-syntax">)) &amp;&amp; ~~</span><span class="identifier-syntax">LanguageVerbMayBeName</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_word</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM_CopyBuffer</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">RECONSTRUCT_INPUT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Now we insert the answer into the original typed command, as</span>
<span class="plain-syntax">    </span><span class="comment-syntax">words additionally describing the same object</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(eg, &gt; take red button</span>
<span class="plain-syntax">    </span><span class="comment-syntax">     Which one, ...</span>
<span class="plain-syntax">    </span><span class="comment-syntax">     &gt; music</span>
<span class="plain-syntax">    </span><span class="comment-syntax">becomes "take music red button".  The parser will thus have three</span>
<span class="plain-syntax">    </span><span class="comment-syntax">words to work from next time, not two.)</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">match_from</span><span class="plain-syntax">) - </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">; </span><span class="identifier-syntax">l</span><span class="plain-syntax">=</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;1+1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">buffer</span><span class="plain-syntax"> + </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;0 - </span><span class="constant-syntax">1</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&gt;=</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">+</span><span class="identifier-syntax">k</span><span class="plain-syntax">+</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">--) </span><span class="identifier-syntax">j</span><span class="plain-syntax">-&gt;0 = </span><span class="constant-syntax">0</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">j</span><span class="plain-syntax">-</span><span class="identifier-syntax">l</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">k</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;(2+</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">k</span><span class="plain-syntax">+</span><span class="identifier-syntax">l</span><span class="plain-syntax">-1) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 + </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 &gt;= (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;0 - </span><span class="constant-syntax">1</span><span class="plain-syntax">)) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;0;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">match_from</span><span class="plain-syntax">) - </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">) / </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;0) + </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&gt;=</span><span class="identifier-syntax">k</span><span class="plain-syntax">+</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">--) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">j</span><span class="plain-syntax">-</span><span class="identifier-syntax">l</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">k</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;(1+</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">k</span><span class="plain-syntax">+</span><span class="identifier-syntax">l</span><span class="plain-syntax">-1) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 + </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 &gt; (</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 = (</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">CHARSIZE</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Having reconstructed the input, we warn the parser accordingly</span>
<span class="plain-syntax">    </span><span class="comment-syntax">and get out.</span>

<span class="plain-syntax">    .</span><span class="identifier-syntax">RECONSTRUCT_INPUT</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">num_words</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordCount</span><span class="plain-syntax">(); </span><span class="identifier-syntax">players_command</span><span class="plain-syntax"> = </span><span class="constant-syntax">100</span><span class="plain-syntax"> + </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LanguageToInformese</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="comment-syntax">Re-tokenise:</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">,</span><span class="identifier-syntax">parse</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">player</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">FollowRulebook</span><span class="plain-syntax">(</span><span class="identifier-syntax">Activity_after_rulebooks</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">READING_A_COMMAND_ACT</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Now we come to the question asked when the input has run out</span>
<span class="plain-syntax">    </span><span class="comment-syntax">and can't easily be guessed (eg, the player typed "take" and there</span>
<span class="plain-syntax">    </span><span class="comment-syntax">were plenty of things which might have been meant).</span>

<span class="plain-syntax">  .</span><span class="identifier-syntax">Incomplete</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax">) </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'D'</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax">                           </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'E'</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=2 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">answer_words</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Keyboard</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Look for a comma, and interpret this as a fresh conversation command</span>
<span class="plain-syntax">    </span><span class="comment-syntax">if so:</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">answer_words</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordFrom</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">) == </span><span class="identifier-syntax">comma_word</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">VM_CopyBuffer</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">RECONSTRUCT_INPUT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">first_word</span><span class="plain-syntax">=(</span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first_word</span><span class="plain-syntax">==0) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">first_word</span><span class="plain-syntax">=</span><span class="identifier-syntax">LanguageIsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Once again, if the reply looks like a command, give it to the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">parser to get on with and forget about the question...</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">WordMarkedAsVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_word</span><span class="plain-syntax">)) &amp;&amp; ~~</span><span class="identifier-syntax">LanguageVerbMayBeName</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_word</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM_CopyBuffer</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">RECONSTRUCT_INPUT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">...but if we have a genuine answer, then:</span>
<span class="plain-syntax">    </span>
<span class="plain-syntax">    </span><span class="comment-syntax">(1) we must glue in text suitable for anything that's been inferred.</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">inferfrom</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="identifier-syntax">PATTERN_NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">+</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1; (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1)++; </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0)++; </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">5</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Gluing in inference at "</span><span class="plain-syntax">, </span><span class="identifier-syntax">j</span><span class="plain-syntax">, </span><span class="string-syntax">" with pattern code "</span><span class="plain-syntax">, </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">            </span><span class="comment-syntax">Conveniently, parse2--&gt;1 is the first word in both ZCODE and GLULX.</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1 = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="comment-syntax">An inferred object.  Best we can do is glue in a pronoun.</span>
<span class="plain-syntax">            </span><span class="comment-syntax">(This is imperfect, but it's very seldom needed anyway.)</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dont_infer_pronoun</span><span class="plain-syntax"> == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">PronounNotice</span><span class="plain-syntax">(</span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">k</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">k</span><span class="plain-syntax">=</span><span class="identifier-syntax">k</span><span class="plain-syntax">+3)</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">k</span><span class="plain-syntax">+2)) {</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1 = </span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">5</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Using pronoun '"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1, </span><span class="string-syntax">"']^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        }</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="comment-syntax">An inferred preposition.</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1 = </span><span class="identifier-syntax">VM_NumberToDictionaryAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> - </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">5</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[Using preposition '"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1, </span><span class="string-syntax">"']^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            </span><span class="comment-syntax">parse2--&gt;1 now holds the dictionary address of the word to glue in.</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1 ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">TARGET_ZCODE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax"> + </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                @</span><span class="identifier-syntax">output_stream</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1;</span>
<span class="plain-syntax">                @</span><span class="identifier-syntax">output_stream</span><span class="plain-syntax"> -3;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">k</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax"> : </span><span class="identifier-syntax">l</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">k</span><span class="plain-syntax"> : </span><span class="identifier-syntax">l</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">l</span><span class="plain-syntax">+2);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax"> + </span><span class="identifier-syntax">k</span><span class="plain-syntax">; </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 = </span><span class="identifier-syntax">i</span><span class="plain-syntax">-2;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">; </span><span class="comment-syntax">TARGET_GLULX</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Glulx_PrintAnyToArrayUni</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">+</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">*</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax"> + </span><span class="identifier-syntax">k</span><span class="plain-syntax">; </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">i</span><span class="plain-syntax"> - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">TARGET_</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">(2) we must glue the newly-typed text onto the end.</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">+</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1; (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1)++; </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++,</span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">j</span><span class="plain-syntax">+2);</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1)++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 == </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0)++; </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++,</span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">j</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0)++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 == </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">CHARSIZE</span>

<span class="plain-syntax">    </span><span class="comment-syntax">(3) we fill up the buffer with spaces, which is unnecessary, but may</span>
<span class="plain-syntax">    </span><span class="comment-syntax">    help incorrectly-written interpreters to cope.</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">RECONSTRUCT_INPUT</span><span class="plain-syntax">;</span>

<span class="plain-syntax">]; </span><span class="comment-syntax">end of NounDomain</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_R</span><span class="plain-syntax">; ];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP38" class="paragraph-anchor"></a><b>&#167;38. Adjudicate. </b>The <span class="extract"><span class="extract-syntax">Adjudicate</span></span> routine tries to see if there is an obvious choice, when
faced with a list of objects (the <span class="extract"><span class="extract-syntax">match_list</span></span>) each of which matches the
player's specification equally well. To do this it makes use of the <span class="extract"><span class="extract-syntax">context</span></span>
(the token type being worked on).
</p>

<p class="commentary">It counts up the number of obvious choices for the given context &mdash; all to
do with where a candidate is, except for 6 (<span class="extract"><span class="extract-syntax">animate</span></span>) which is to
do with whether it is animate or not &mdash; and then:
</p>

<ul class="items"><li>(a) if only one obvious choice is found, that is returned;
</li><li>(b) if we are in indefinite mode (don't care which) one of the obvious choices
is returned, or if there is no obvious choice then an unobvious one is made;
</li><li>(c) at this stage, we work out whether the objects are distinguishable from
each other or not: if they are all indistinguishable from each other, then
choose one, it doesn't matter which;
</li><li>(d) otherwise, 0 (meaning, unable to decide) is returned (but remember
that the equivalence classes we've just worked out will be needed by other
routines to clear up this mess, so we can't economise on working them out).
</li></ul>
<p class="commentary"><span class="extract"><span class="extract-syntax">Adjudicate</span></span> returns \(-1\) if an error occurred.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">Adjudicate</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax"> </span><span class="identifier-syntax">last</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="identifier-syntax">ultimate</span><span class="plain-syntax"> </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> </span><span class="identifier-syntax">offset</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   [Adjudicating match list of size "</span><span class="plain-syntax">, </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">" in context "</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"indefinite type: "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">OTHER_BIT</span><span class="plain-syntax">)  </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"other "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">MY_BIT</span><span class="plain-syntax">)     </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"my "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">THAT_BIT</span><span class="plain-syntax">)   </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"that "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"plural "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">LIT_BIT</span><span class="plain-syntax">)    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"lit "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">UNLIT_BIT</span><span class="plain-syntax">)  </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"unlit "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"owner:"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   number wanted: "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> == </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"all"</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">new_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   most likely GNAs of names: "</span><span class="plain-syntax">, </span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"definite object^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">-1; </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">last</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">j</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ultimate</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">n</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">HELD_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">n</span><span class="plain-syntax">)==</span><span class="identifier-syntax">actor</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        {   </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">ultimate</span><span class="plain-syntax">==</span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            &amp;&amp; </span><span class="identifier-syntax">n</span><span class="plain-syntax">~=</span><span class="identifier-syntax">actor</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">concealed</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">scenery</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        {   </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIHELD_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">n</span><span class="plain-syntax">)==</span><span class="identifier-syntax">actor</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        {   </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        {   </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax">==-1)</span>
<span class="plain-syntax">            {   </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                {   </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                 }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                {   </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">n</span><span class="plain-syntax">)~=</span><span class="identifier-syntax">actor</span><span class="plain-syntax">) { </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">                 }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            {   </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">n</span><span class="plain-syntax">~=</span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                {   </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="reserved-syntax">in</span><span class="plain-syntax"> </span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                {   </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">         }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax">==</span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">CreatureTest</span><span class="plain-syntax">(</span><span class="identifier-syntax">n</span><span class="plain-syntax">)==1)</span>
<span class="plain-syntax">        {   </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax">++; </span><span class="identifier-syntax">last</span><span class="plain-syntax">=</span><span class="identifier-syntax">n</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">1000</span><span class="plain-syntax">*(</span><span class="identifier-syntax">good_ones</span><span class="plain-syntax"> - </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">good_ones</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIHELD_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">last</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">last</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">RulebookFailed</span><span class="plain-syntax">())) </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">last</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">good_ones</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">last</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">last</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">If there is ambiguity about what was typed, but it definitely wasn't</span>
<span class="plain-syntax">    </span><span class="comment-syntax">animate as required, then return anything; higher up in the parser</span>
<span class="plain-syntax">    </span><span class="comment-syntax">a suitable error will be given.  (This prevents a question being asked.)</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">good_ones</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;0;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax">=0;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">ScoreMatchL</span><span class="plain-syntax">(</span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax"> Is there now a single highest-scoring object?</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SingleBestGuess</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>

<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Single best-scoring object returned.]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIHELD_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span>
<span class="plain-syntax">                     </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">etype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">MULTI_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">offset</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">BestGuess</span><span class="plain-syntax">(): </span><span class="identifier-syntax">j</span><span class="plain-syntax">~=-1 &amp;&amp; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">offset</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax">-1:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">BestGuess</span><span class="plain-syntax">()) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">j</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">j</span><span class="plain-syntax">)) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">concealed</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">worn</span><span class="plain-syntax">) </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTIHELD_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">j</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">actor</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Take</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Remove</span><span class="plain-syntax"> &amp;&amp; </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">j</span><span class="plain-syntax">) == </span><span class="identifier-syntax">actor</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">                </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ChooseObjects</span><span class="plain-syntax">(</span><span class="identifier-syntax">j</span><span class="plain-syntax">, </span><span class="identifier-syntax">flag</span><span class="plain-syntax">);</span>

<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RulebookSucceeded</span><span class="plain-syntax">()) </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_WHETHER_ALL_INC_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">j</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">i</span><span class="plain-syntax">++; </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">offset</span><span class="plain-syntax">) = </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Accepting it^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Rejecting it^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multi_wanted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Too few found in Adjudicate^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multi_had</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">; </span><span class="comment-syntax">Allow to proceed for now</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">offset</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multi_context</span><span class="plain-syntax"> = </span><span class="identifier-syntax">context</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Made multiple object of size "</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">++; </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">Identical</span><span class="plain-syntax">(</span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">) == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">flag</span><span class="plain-syntax">=1;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">-</span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">     </span><span class="identifier-syntax">n</span><span class="plain-syntax">--; </span><span class="identifier-syntax">number_of_classes</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Grouped into "</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">, </span><span class="string-syntax">" possibilities by name:^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">The</span><span class="plain-syntax">) </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">" ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">")  ---  group "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                  </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">k</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">j</span><span class="plain-syntax">*</span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">k</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">) * (</span><span class="identifier-syntax">match_classes</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">j</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Unable to choose best group, so ask player.]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Best choices are all from the same group.^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> When the player is really vague, or there's a single collection of</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> indistinguishable objects to choose from, choose the one the player</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> most recently acquired, or if the player has none of them, then</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> the one most recently put where it is.</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">dont_infer</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">BestGuess</span><span class="plain-syntax">();</span>

<span class="plain-syntax">]; </span><span class="comment-syntax">Adjudicate</span>
</pre>
<p class="commentary firstcommentary"><a id="SP39" class="paragraph-anchor"></a><b>&#167;39. ReviseMulti. </b><span class="extract"><span class="extract-syntax">ReviseMulti</span></span> revises the multiple object which already exists, in the
light of information which has come along since then (i.e., the second
parameter).  It returns a parser error number, or else 0 if all is well.
This only ever throws things out, never adds new ones.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ReviseMulti</span><span class="plain-syntax"> </span><span class="identifier-syntax">second_p</span><span class="plain-syntax">  </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">low</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Revising multiple object list of size "</span><span class="plain-syntax">, </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0,</span>
<span class="plain-syntax">        </span><span class="string-syntax">" with 2nd "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">second_p</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">multi_context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1,</span><span class="identifier-syntax">low</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ( (</span><span class="identifier-syntax">multi_context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIEXCEPT_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">second_p</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                 (</span><span class="identifier-syntax">multi_context</span><span class="plain-syntax">==</span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="reserved-syntax">in</span><span class="plain-syntax"> </span><span class="identifier-syntax">second_p</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">low</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">low</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">low</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">multi_context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTI_TOKEN</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Take</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Token 2 plural case: number with actor "</span><span class="plain-syntax">, </span><span class="identifier-syntax">low</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">take_all_rule</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1,</span><span class="identifier-syntax">low</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">low</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">low</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">low</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Done: new size "</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOTHING_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP40" class="paragraph-anchor"></a><b>&#167;40. Match List. </b>The match list is an array, <span class="extract"><span class="extract-syntax">match_list--&gt;</span></span>, which holds the current best
guesses at what object(s) a portion of the command refers to. The global
<span class="extract"><span class="extract-syntax">number_matched</span></span> is set to the current length of the <span class="extract"><span class="extract-syntax">match_list</span></span>.
</p>

<p class="commentary">When the parser sees a possible match of object <span class="extract"><span class="extract-syntax">obj</span></span> at quality level <span class="extract"><span class="extract-syntax">q</span></span>,
it calls <span class="extract"><span class="extract-syntax">MakeMatch(obj, q)</span></span>. If this is the best quality match so far, then
we wipe out all the previous matches and start a new list with this one.
If it's only as good as the best so far, we add it to the list (provided
we haven't run out of space, and provided it isn't in the list already).
If it's worse, we ignore it altogether.
</p>

<p class="commentary">I6 tokens in the form <span class="extract"><span class="extract-syntax">noun=Filter</span></span> or <span class="extract"><span class="extract-syntax">Attribute</span></span> are "noun filter tokens",
and mean that the match list should be filtered to accept only nouns which
are acceptable to the given routine, or have the given attribute. Such a
token is in force if <span class="extract"><span class="extract-syntax">token_filter</span></span> is used. (I7 makes no use of this in the
attribute case, which is deprecated nowadays.)
</p>

<p class="commentary">Quality is essentially the number of words in the command referring to
the object: the idea is that "red panic button" is better than "red button"
or "panic".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">MakeMatch</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">quality</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">6</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"    Match with quality "</span><span class="plain-syntax">,</span><span class="identifier-syntax">quality</span><span class="plain-syntax">,</span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">ConsultNounFilterToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">6</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"    Match filtered out: token filter "</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">quality</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">quality</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">) { </span><span class="identifier-syntax">match_length</span><span class="plain-syntax"> = </span><span class="identifier-syntax">quality</span><span class="plain-syntax">; </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">obj</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">++ = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">6</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"    Match added to list^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ConsultNounFilterToken</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">sn</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">sn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">noun</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">-1)) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP41" class="paragraph-anchor"></a><b>&#167;41. ScoreMatchL. </b><span class="extract"><span class="extract-syntax">ScoreMatchL</span></span> scores the match list for quality in terms of what the player
has vaguely asked for. Points are awarded for conforming with requirements
like "my", and so on. Remove from the match list any entries which fail
the basic requirements of the descriptors. (The scoring system used to
evaluate the possibilities is discussed in detail in the DM4.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__CHOOSEOBJ</span><span class="plain-syntax"> = </span><span class="constant-syntax">1000</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__IFGOOD</span><span class="plain-syntax"> = </span><span class="constant-syntax">500</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__UNCONCEALED</span><span class="plain-syntax"> = </span><span class="constant-syntax">100</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__BESTLOC</span><span class="plain-syntax"> = </span><span class="constant-syntax">60</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__NEXTBESTLOC</span><span class="plain-syntax"> = </span><span class="constant-syntax">40</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__NOTCOMPASS</span><span class="plain-syntax"> = </span><span class="constant-syntax">20</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__NOTSCENERY</span><span class="plain-syntax"> = </span><span class="constant-syntax">10</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__NOTACTOR</span><span class="plain-syntax"> = </span><span class="constant-syntax">5</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__GNA</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCORE__DIVISOR</span><span class="plain-syntax"> = </span><span class="constant-syntax">20</span><span class="plain-syntax">;</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ScoreMatchL</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax"> </span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">threshold</span><span class="plain-syntax"> </span><span class="identifier-syntax">met</span><span class="plain-syntax"> </span><span class="identifier-syntax">a_s</span><span class="plain-syntax"> </span><span class="identifier-syntax">l_s</span><span class="plain-syntax">;</span>
<span class="comment-syntax">  if (indef_type &amp; OTHER_BIT ~= 0) threshold++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">MY_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)    </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">THAT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)  </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">LIT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)   </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">UNLIT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> ~= </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">)      </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">++;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Scoring match list: indef mode "</span><span class="plain-syntax">, </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax">, </span><span class="string-syntax">" type "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">      </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax">, </span><span class="string-syntax">", satisfying "</span><span class="plain-syntax">, </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">, </span><span class="string-syntax">" requirements:^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">a_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SCORE__BESTLOC</span><span class="plain-syntax">; </span><span class="identifier-syntax">l_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SCORE__NEXTBESTLOC</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">Take</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> ##</span><span class="identifier-syntax">Remove</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">a_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SCORE__NEXTBESTLOC</span><span class="plain-syntax">; </span><span class="identifier-syntax">l_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SCORE__BESTLOC</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">context</span><span class="plain-syntax"> = </span><span class="identifier-syntax">context</span><span class="plain-syntax">;  </span><span class="comment-syntax">silence warning</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">; </span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> = </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">); </span><span class="identifier-syntax">its_score</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">met</span><span class="plain-syntax">=0;</span>

<span class="plain-syntax">        </span><span class="comment-syntax">     if (indef_type &amp; OTHER_BIT ~= 0</span>
<span class="plain-syntax">        </span><span class="comment-syntax">         &amp;&amp;  obj ~= itobj or himobj or herobj) met++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">MY_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) </span><span class="identifier-syntax">met</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">THAT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">) </span><span class="identifier-syntax">met</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">LIT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax">) </span><span class="identifier-syntax">met</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">UNLIT_BIT</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">light</span><span class="plain-syntax">) </span><span class="identifier-syntax">met</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; ((</span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> == </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">CoreOf</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">) == </span><span class="identifier-syntax">indef_owner</span><span class="plain-syntax">))) </span><span class="identifier-syntax">met</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">met</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">The</span><span class="plain-syntax">) </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">" ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">") in "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_owner</span><span class="plain-syntax">, </span><span class="string-syntax">" is rejected (doesn't match descriptors)^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">concealed</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SCORE__UNCONCEALED</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> + </span><span class="identifier-syntax">a_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> + </span><span class="identifier-syntax">l_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">its_owner</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">Compass</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> + </span><span class="identifier-syntax">SCORE__NOTCOMPASS</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> + </span><span class="identifier-syntax">SCORE__CHOOSEOBJ</span><span class="plain-syntax"> * </span><span class="identifier-syntax">ChooseObjects</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">scenery</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> + </span><span class="identifier-syntax">SCORE__NOTSCENERY</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> + </span><span class="identifier-syntax">SCORE__NOTACTOR</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="comment-syntax">  A small bonus for having the correct GNA,</span>
<span class="plain-syntax">            </span><span class="comment-syntax">  for sorting out ambiguous articles and the like.</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_cases</span><span class="plain-syntax"> &amp; (</span><span class="identifier-syntax">PowersOfTwo_TB</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">GetGNAOfObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">))))</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> + </span><span class="identifier-syntax">SCORE__GNA</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> + </span><span class="identifier-syntax">its_score</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"     "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">The</span><span class="plain-syntax">) </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">,</span>
<span class="plain-syntax">              </span><span class="string-syntax">" in "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">its_owner</span><span class="plain-syntax">, </span><span class="string-syntax">" : "</span><span class="plain-syntax">, </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="string-syntax">" points^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">     }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == -1) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">-1) { </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">--; </span><span class="reserved-syntax">break</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">-1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">j</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">j</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP42" class="paragraph-anchor"></a><b>&#167;42. BestGuess. </b><span class="extract"><span class="extract-syntax">BestGuess</span></span> makes the best guess it can out of the match list, assuming that
everything in the match list is textually as good as everything else;
however it ignores items marked as \(-1\), and so marks anything it chooses.
It returns \(-1\) if there are no possible choices.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">BestGuess</span><span class="plain-syntax">  </span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> </span><span class="identifier-syntax">best</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">best</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">best</span><span class="plain-syntax">) { </span><span class="identifier-syntax">best</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax">; </span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">)</span>
<span class="plain-syntax">      </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">best</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Best guess ran out of choices^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"   Best guess "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">earliest</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">best</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">earliest</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP43" class="paragraph-anchor"></a><b>&#167;43. SingleBestGuess. </b><span class="extract"><span class="extract-syntax">SingleBestGuess</span></span> returns the highest-scoring object in the match list
if it is the clear winner, or returns \(-1\) if there is no clear winner.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">SingleBestGuess</span><span class="plain-syntax">  </span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> </span><span class="identifier-syntax">best</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> = -1; </span><span class="identifier-syntax">best</span><span class="plain-syntax"> = -1000;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_scores</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> == </span><span class="identifier-syntax">best</span><span class="plain-syntax">) </span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">its_score</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">best</span><span class="plain-syntax">) { </span><span class="identifier-syntax">best</span><span class="plain-syntax"> = </span><span class="identifier-syntax">its_score</span><span class="plain-syntax">; </span><span class="identifier-syntax">earliest</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">earliest</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP44" class="paragraph-anchor"></a><b>&#167;44. Identical. </b><span class="extract"><span class="extract-syntax">Identical</span></span> decides whether or not two objects can be distinguished from each
other by anything the player can type. If not, it returns <span class="extract"><span class="extract-syntax">true</span></span>. (This
routine is critical to the handling of plurals, and the list-writer
requires it to be an equivalence relation between objects: but it is,
because it is equivalent to \(O_1\sim O_2\) if and only if \(f(O_1) = f(O_2)\)
for some function \(f\).)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">Identical</span><span class="plain-syntax"> </span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="identifier-syntax">p1</span><span class="plain-syntax"> </span><span class="identifier-syntax">p2</span><span class="plain-syntax"> </span><span class="identifier-syntax">n1</span><span class="plain-syntax"> </span><span class="identifier-syntax">n2</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">flag</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o1</span><span class="plain-syntax"> == </span><span class="identifier-syntax">o2</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;  </span><span class="comment-syntax">This should never happen, but to be on the safe side</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o1</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax"> || </span><span class="identifier-syntax">o2</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;  </span><span class="comment-syntax">Similarly</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o1</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K3_direction</span><span class="plain-syntax"> || </span><span class="identifier-syntax">o2</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K3_direction</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">; </span><span class="comment-syntax">Saves time</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> What complicates things is that o1 or o2 might have a parsing routine,</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> so the parser can't know from here whether they are or aren't the same.</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> If they have different parsing routines, we simply assume they're</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> different.  If they have the same routine (which they probably got from</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> a class definition) then the decision process is as follows:</span>
<span class="plain-syntax">    </span>
<span class="plain-syntax">    </span><span class="comment-syntax">    the routine is called (with self being o1, not that it matters)</span>
<span class="plain-syntax">    </span><span class="comment-syntax">      with noun and second being set to o1 and o2, and action being set</span>
<span class="plain-syntax">    </span><span class="comment-syntax">      to the fake action TheSame.  If it returns -1, they are found</span>
<span class="plain-syntax">    </span><span class="comment-syntax">      identical; if -2, different; and if &gt;=0, then the usual method</span>
<span class="plain-syntax">    </span><span class="comment-syntax">      is used instead.</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o1</span><span class="plain-syntax">.</span><span class="identifier-syntax">parse_name</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> || </span><span class="identifier-syntax">o2</span><span class="plain-syntax">.</span><span class="identifier-syntax">parse_name</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">      </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o1</span><span class="plain-syntax">.</span><span class="identifier-syntax">parse_name</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">o2</span><span class="plain-syntax">.</span><span class="identifier-syntax">parse_name</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="identifier-syntax">parser_action</span><span class="plain-syntax"> = ##</span><span class="identifier-syntax">TheSame</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o1</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RunRoutines</span><span class="plain-syntax">(</span><span class="identifier-syntax">o1</span><span class="plain-syntax">,</span><span class="identifier-syntax">parse_name</span><span class="plain-syntax">); </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == -1) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == -2) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> This is the default algorithm: do they have the same words in their</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> "name" (i.e. property no. 1) properties.  (Note that the following allows</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> for repeated words and words in different orders.)</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">p1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o1</span><span class="plain-syntax">.&amp;</span><span class="identifier-syntax">name</span><span class="plain-syntax">; </span><span class="identifier-syntax">n1</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">o1</span><span class="plain-syntax">.#</span><span class="identifier-syntax">name</span><span class="plain-syntax">)/</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">p2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o2</span><span class="plain-syntax">.&amp;</span><span class="identifier-syntax">name</span><span class="plain-syntax">; </span><span class="identifier-syntax">n2</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">o2</span><span class="plain-syntax">.#</span><span class="identifier-syntax">name</span><span class="plain-syntax">)/</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax">  for (i=0 : i&lt;n1 : i++) { print (address) p1--&gt;i, " "; } new_line;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">  for (i=0 : i&lt;n2 : i++) { print (address) p2--&gt;i, " "; } new_line;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">n1</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">n2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">p1</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">p2</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">) </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">n2</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">n1</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">p1</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">p2</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">) </span><span class="identifier-syntax">flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">  print "Which are identical!^";</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP45" class="paragraph-anchor"></a><b>&#167;45. Print Command. </b><span class="extract"><span class="extract-syntax">PrintCommand</span></span> reconstructs the command as it presently reads, from the
pattern which has been built up.
</p>

<p class="commentary">If <span class="extract"><span class="extract-syntax">from</span></span> is 0, it starts with the verb: then it goes through the pattern.
</p>

<p class="commentary">The other parameter is <span class="extract"><span class="extract-syntax">emptyf</span></span> &mdash; a flag: if 0, it goes up to <span class="extract"><span class="extract-syntax">pcount</span></span>:
if 1, it goes up to <span class="extract"><span class="extract-syntax">pcount</span></span>-1.
</p>

<p class="commentary">Note that verbs and prepositions are printed out of the dictionary:
and that since the dictionary may only preserve the first six characters
of a word (in a V3 game), we have to hand-code the longer words needed.
At present, I7 doesn't do this, but it probably should.
</p>

<p class="commentary">(Recall that pattern entries are 0 for "multiple object", 1 for "special
word", 2 to <span class="extract"><span class="extract-syntax">REPARSE_CODE-1</span></span> are object numbers and <span class="extract"><span class="extract-syntax">REPARSE_CODE+n</span></span> means
the preposition <span class="extract"><span class="extract-syntax">n</span></span>.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">PrintInferredCommand</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">singleton_noun</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">singleton_noun</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">from</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> == </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-1) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">singleton_noun</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">singleton_noun</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">CLARIFYING_PARSERS_CHOICE_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">CLARIFYING_PARSERS_CHOICE_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">from</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"("</span><span class="plain-syntax">; </span><span class="identifier-syntax">PrintCommand</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">")^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">CLARIFYING_PARSERS_CHOICE_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"("</span><span class="plain-syntax">; </span><span class="identifier-syntax">PrintCommand</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">")^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">PrintCommand</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">spacing_flag</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verb_word</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LanguageVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PrintVerb</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">from</span><span class="plain-syntax">++; </span><span class="identifier-syntax">spacing_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax">=</span><span class="identifier-syntax">from</span><span class="plain-syntax"> : </span><span class="identifier-syntax">k</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> : </span><span class="identifier-syntax">k</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pattern</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">PATTERN_NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">spacing_flag</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">char</span><span class="plain-syntax">) </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'F'</span><span class="plain-syntax">); </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">TokenPrinted</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) { </span><span class="identifier-syntax">PARSER_CLARIF_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'G'</span><span class="plain-syntax">); </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">TokenPrinted</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">address</span><span class="plain-syntax">) </span><span class="identifier-syntax">VM_NumberToDictionaryAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-</span><span class="identifier-syntax">REPARSE_CODE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K3_direction</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LanguageDirection</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">; </span><span class="comment-syntax">the direction name as adverb</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      .</span><span class="identifier-syntax">TokenPrinted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">spacing_flag</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP46" class="paragraph-anchor"></a><b>&#167;46. CantSee. </b>The <span class="extract"><span class="extract-syntax">CantSee</span></span> routine returns a good error number for the situation where
the last word looked at didn't seem to refer to any object in context.
</p>

<p class="commentary">The idea is that: if the actor is in a location (but not inside something
like, for instance, a tank which is in that location) then an attempt to
refer to one of the words listed as meaningful-but-irrelevant there
will cause "you don't need to refer to that in this game" rather than
"no such thing" or "what's `it'?".
</p>

<p class="commentary">(The advantage of not having looked at "irrelevant" local nouns until
now is that it stops them from clogging up the ambiguity-resolving process.
Thus game objects always triumph over scenery.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">CantSee</span><span class="plain-syntax">  </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">w</span><span class="plain-syntax"> </span><span class="identifier-syntax">e</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">saved_oops</span><span class="plain-syntax">=</span><span class="identifier-syntax">oops_from</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">scope_token</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">scope_error</span><span class="plain-syntax"> = </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ASKSCOPE_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--; </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CANTSEE_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w</span><span class="plain-syntax"> == </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">(); </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">w</span><span class="plain-syntax"> == -1) || (</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">ENDIT_TOKEN</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">AnalyseToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">line_token</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">-1));</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">found_ttype</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ROUTINE_FILTER_TT</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ATTR_FILTER_TT</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOTINCONTEXT_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">pronoun__word</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pronoun_word</span><span class="plain-syntax">; </span><span class="identifier-syntax">pronoun__obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pronoun_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ITGONE_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">etype</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">e</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">etype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">e</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP47" class="paragraph-anchor"></a><b>&#167;47. Multiple Object List. </b>The <span class="extract"><span class="extract-syntax">MultiAdd</span></span> routine adds object <span class="extract"><span class="extract-syntax">o</span></span> to the multiple-object-list. This is
only allowed to hold <span class="extract"><span class="extract-syntax">MATCH_LIST_WORDS</span></span> minus one objects at most, at which
point it ignores any new entries (and sets a global flag so that a warning
may later be printed if need be).
</p>

<p class="commentary">The <span class="extract"><span class="extract-syntax">MultiSub</span></span> routine deletes object <span class="extract"><span class="extract-syntax">o</span></span> from the multiple-object-list.
It returns 0 if the object was there in the first place, and 9 (because
this is the appropriate error number in <span class="extract"><span class="extract-syntax">Parser()</span></span>) if it wasn't.
</p>

<p class="commentary">The <span class="extract"><span class="extract-syntax">MultiFilter</span></span> routine goes through the multiple-object-list and throws
out anything without the given attribute <span class="extract"><span class="extract-syntax">attr</span></span> set.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">MultiAdd</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax">-1) { </span><span class="identifier-syntax">toomany_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">i</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">o</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">MultiSub</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">i</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax">=</span><span class="identifier-syntax">j</span><span class="plain-syntax"> : </span><span class="identifier-syntax">k</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">i</span><span class="plain-syntax"> : </span><span class="identifier-syntax">k</span><span class="plain-syntax">++) </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">k</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = --</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VAGUE_PE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">MultiFilter</span><span class="plain-syntax"> </span><span class="identifier-syntax">attr</span><span class="plain-syntax">  </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    .</span><span class="identifier-syntax">MFiltl</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">i</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">o</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">attr</span><span class="plain-syntax">) { </span><span class="identifier-syntax">MultiSub</span><span class="plain-syntax">(</span><span class="identifier-syntax">o</span><span class="plain-syntax">); </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">MFiltl</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP48" class="paragraph-anchor"></a><b>&#167;48. Scope. </b>The scope of an actor is the set of objects which he can refer to in typed
commands, which is normally the same as the set of visible objects; but this
can be modified. This is how I7 handles tokens like "[any room]".
</p>

<p class="commentary">Scope determination is done by calling <span class="extract"><span class="extract-syntax">SearchScope</span></span> to iterate through the
objects in scope, and "visit" each one: which means, carry out some task
for each as we get there. The task depends on the current value of
<span class="extract"><span class="extract-syntax">scope_reason</span></span>, which is <span class="extract"><span class="extract-syntax">PARSING_REASON</span></span> when the parser is matching
command text against object names.
</p>

<p class="commentary">The scope machinery is built on a number of levels, each making use only
of lower levels:
</p>

<ul class="items"><li>(0) Either <span class="extract"><span class="extract-syntax">NounDomain</span></span>, <span class="extract"><span class="extract-syntax">TestScope</span></span> or <span class="extract"><span class="extract-syntax">LoopOverScope</span></span> makes one or more
calls to <span class="extract"><span class="extract-syntax">SearchScope</span></span> (on level 1). The point of making multiple calls
is to influence the order in which items in scope are visited, which improves
the quality of "take all"-style multiple object lists, for instance.
</li><li>(1) <span class="extract"><span class="extract-syntax">SearchScope</span></span> searches for the objects in scope which are within first
one domain, and then another: for instance, first within the current room
but not within the current actor, and then within the current actor. It can
be called either from level 0, or externally from the choose-objects
machinery, but is not recursive. It works within the context of a given
token in the parser (when called for <span class="extract"><span class="extract-syntax">PARSING_REASON</span></span>) and in particular
the <span class="extract"><span class="extract-syntax">multiinside</span></span> token, and also handles testing commands, scope tokens,
scope in darkness, and intervention by the I7 "deciding the scope of"
activity. Most of its actual searches are delegated to <span class="extract"><span class="extract-syntax">ScopeWithin</span></span> (level
2), but it also uses <span class="extract"><span class="extract-syntax">DoScopeActionAndRecurse</span></span> (level 3) and
<span class="extract"><span class="extract-syntax">DoScopeAction</span></span> (level 4) as necessary.
</li><li>(2) <span class="extract"><span class="extract-syntax">ScopeWithin</span></span> iterates through the objects in scope which are within
one supplied domain, but not within another. It can be called either
from level 1, or independently from rules in the "deciding the scope of"
activity via the I7 "place the contents of X in scope" phrase. It calls
<span class="extract"><span class="extract-syntax">DoScopeActionAndRecurse</span></span> (level 3) on any unconcealed objects it finds.
</li><li>(3) <span class="extract"><span class="extract-syntax">DoScopeActionAndRecurse</span></span> visits a given object by calling down to
<span class="extract"><span class="extract-syntax">DoScopeAction</span></span> (level 4), and recurses to all unconcealed object-tree
contents and component parts of the object. The I7 phrase "place X in
scope" uses this routine.
</li><li>(4) <span class="extract"><span class="extract-syntax">DoScopeAction</span></span> simply visits a single object, taking whatever action
is needed there &mdash; which will depend on the <span class="extract"><span class="extract-syntax">scope_reason</span></span>. The only use
made by the parser of <span class="extract"><span class="extract-syntax">TryGivenObject</span></span>, which tries to match command text
against the name of a given object, is from here. The I7 phrase "place X
in scope, but not its contents" uses this routine.
</li></ul>
<p class="commentary">Two routines are provided for code external to the parser to modify the
scope. They should be called only during scope deliberations &mdash; i.e.,
in <span class="extract"><span class="extract-syntax">scope=...</span></span> tokens or in rules for the "deciding the scope of"
activity. (At present, <span class="extract"><span class="extract-syntax">AddToScope</span></span> is not used in I7 at all.) Note
that this I7 form of <span class="extract"><span class="extract-syntax">PlaceInScope</span></span> has a slightly different specification
to its I6 library counterpart of the same name: it can place a room in
scope. (In I6, room names were not normally parsed.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">PlaceInScope</span><span class="plain-syntax"> </span><span class="identifier-syntax">O</span><span class="plain-syntax"> </span><span class="identifier-syntax">opts</span><span class="plain-syntax"> </span><span class="identifier-syntax">ws</span><span class="plain-syntax">; </span><span class="comment-syntax">If opts is set, do not place contents in scope</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ws</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">opts</span><span class="plain-syntax"> == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="identifier-syntax">O</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">DoScopeAction</span><span class="plain-syntax">(</span><span class="identifier-syntax">O</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ws</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">AddToScope</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ats_flag</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">ats_flag</span><span class="plain-syntax">-2);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ats_flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) { </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">HasLightSource</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">)==1) </span><span class="identifier-syntax">ats_hls</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP49" class="paragraph-anchor"></a><b>&#167;49. Scope Level 0. </b>The two ways of starting up the scope machinery other than via the parser
code above.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">TestScope</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">al</span><span class="plain-syntax"> </span><span class="identifier-syntax">sr</span><span class="plain-syntax"> </span><span class="identifier-syntax">ss</span><span class="plain-syntax"> </span><span class="identifier-syntax">st</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="identifier-syntax">y</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax">; </span><span class="identifier-syntax">y</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">a</span><span class="plain-syntax"> = </span><span class="identifier-syntax">actor</span><span class="plain-syntax">; </span><span class="identifier-syntax">al</span><span class="plain-syntax"> = </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ss</span><span class="plain-syntax"> = </span><span class="identifier-syntax">scope_stage</span><span class="plain-syntax">; </span><span class="identifier-syntax">st</span><span class="plain-syntax"> = </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scope_stage</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax">; </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TESTSCOPE_REASON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">act</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">player</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">act</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">SearchScope</span><span class="plain-syntax">(</span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">); </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sr</span><span class="plain-syntax">; </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scope_stage</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ss</span><span class="plain-syntax">; </span><span class="identifier-syntax">scope_token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">st</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">al</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">x</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax"> = </span><span class="identifier-syntax">y</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">LoopOverScope</span><span class="plain-syntax"> </span><span class="identifier-syntax">routine</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="identifier-syntax">y</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">al</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax">; </span><span class="identifier-syntax">y</span><span class="plain-syntax"> = </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax">; </span><span class="identifier-syntax">a</span><span class="plain-syntax"> = </span><span class="identifier-syntax">actor</span><span class="plain-syntax">; </span><span class="identifier-syntax">al</span><span class="plain-syntax"> = </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">routine</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">act</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">player</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">act</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScopeCeiling</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LOOPOVERSCOPE_REASON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">SearchScope</span><span class="plain-syntax">(</span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">x</span><span class="plain-syntax">; </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> = </span><span class="identifier-syntax">y</span><span class="plain-syntax">; </span><span class="identifier-syntax">actor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a</span><span class="plain-syntax">; </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax"> = </span><span class="identifier-syntax">al</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP50" class="paragraph-anchor"></a><b>&#167;50. SearchScope. </b>Level 1. The method is:
</p>

<ul class="items"><li>(a) If the context is a <span class="extract"><span class="extract-syntax">scope=...</span></span> token, then the search is delegated
to "stage 2" of the scope routine. This was the old I6 way to override
the searching behaviour: while users probably won't be using it any more,
the template does, in order to give testing commands universal scope which
is exempt from the activity below; and the NI compiler creates <span class="extract"><span class="extract-syntax">scope=...</span></span>
tokens to handle Understand grammar such as "[any room]". So the feature
remains very much still in use.
</li><li>(b) The "deciding the scope of" activity is given the chance to intervene.
This is the I7 way to override the searching behaviour, and is the one taken
by users.
</li><li>(c) And otherwise:
<ul class="items"><li>(1) The I6 <span class="extract"><span class="extract-syntax">multiinside</span></span> token, used as the first noun of its grammar line,
has as its scope all of the objects which are inside or on top of the
{\it second} noun of the grammar line. This provides a neat scope for the
ALL in a command like GET ALL FROM CUPBOARD, where the player clearly
does not intend ALL to refer to the cupboard itself, for instance. The
difficulty is that we don't yet know what the second object is, if we are
parsing left to right. But the parser code above has taken care of all of
that, and the <span class="extract"><span class="extract-syntax">advance_warning</span></span> global is set to the object number of the
second noun, or to \(-1\) if that is not yet known. Note that we check that
the contents are visible before adding them to scope, because otherwise
an unscrupulous player could use such a command to detect the contents of
an opaque locked box. If this rule applies, we skip (c.2), (c.3) and (c.4).
</li><li>(2) For all other tokens except <span class="extract"><span class="extract-syntax">creature</span></span>, searching scope for the room
holding the current actor always catches the compass directions unless a
definite article has already been typed. (Thus OPEN THE EAST would match
an object called "east door", but not the compass direction "east".)
</li><li>(3) The contents of <span class="extract"><span class="extract-syntax">domain1</span></span> which are not contents of <span class="extract"><span class="extract-syntax">domain2</span></span> are
placed in scope, and so are any component parts of <span class="extract"><span class="extract-syntax">domain1</span></span>. If <span class="extract"><span class="extract-syntax">domain1</span></span>
is a container or supporter, it is placed in scope itself.
</li><li>(4) The contents and component parts of <span class="extract"><span class="extract-syntax">domain2</span></span> are placed in scope.
If <span class="extract"><span class="extract-syntax">domain2</span></span> is a container or supporter, it is placed in scope itself.
</li><li>(5) In darkness, the actor and his component parts are in scope. If the
actor is inside or on top of something, then that thing is also in scope.
(This avoids a situation where the player gets into an opaque box, then
pulls it closed from the inside, plunging himself into darkness, then types
OPEN BOX only to be told that he can't see any such thing.)
</li></ul>
</li></ul>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">SearchScope</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain1</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain2</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">domain1</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(a)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">scope_token</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">scope_stage</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"  [Scope routine called at stage 2]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">scope_token</span><span class="plain-syntax">() ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="comment-syntax">(b)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">BeginActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_SCOPE_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ForActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_SCOPE_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">(c.1)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> == </span><span class="identifier-syntax">PARSING_REASON</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> == </span><span class="identifier-syntax">MULTIINSIDE_TOKEN</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax"> ~= -1)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">IsSeeThrough</span><span class="plain-syntax">(</span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax">) == </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ScopeWithin</span><span class="plain-syntax">(</span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="comment-syntax">(c.2)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax"> == </span><span class="identifier-syntax">PARSING_REASON</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">context</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">CREATURE_TOKEN</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">domain1</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">ScopeWithin</span><span class="plain-syntax">(</span><span class="identifier-syntax">Compass</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="comment-syntax">(c.3)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">domain1</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">supporter</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax">) </span><span class="identifier-syntax">DoScopeAction</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ScopeWithin</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain1</span><span class="plain-syntax">, </span><span class="identifier-syntax">domain2</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="comment-syntax">(c.4)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">domain2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">domain2</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">supporter</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax">) </span><span class="identifier-syntax">DoScopeAction</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ScopeWithin</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain2</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="comment-syntax">(c.5)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">thedark</span><span class="plain-syntax"> == </span><span class="identifier-syntax">domain1</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">) </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">supporter</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">container</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">), </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">), </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">EndActivity</span><span class="plain-syntax">(</span><span class="identifier-syntax">DECIDING_SCOPE_ACT</span><span class="plain-syntax">, </span><span class="identifier-syntax">actor</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP51" class="paragraph-anchor"></a><b>&#167;51. ScopeWithin. </b>Level 2. <span class="extract"><span class="extract-syntax">ScopeWithin</span></span> puts objects visible from within the <span class="extract"><span class="extract-syntax">domain</span></span> into scope.
An item belonging to the <span class="extract"><span class="extract-syntax">domain</span></span> is placed in scope unless it is being
concealed by the <span class="extract"><span class="extract-syntax">domain</span></span>: and even then, if the <span class="extract"><span class="extract-syntax">domain</span></span> is the current
actor. Suppose Zorro conceals a book beneath his cloak: then the book is
not in scope to his lady friend The Black Whip, but it is in scope to Zorro
himself. (Thus an actor is not allowed to conceal anything from himself.)
</p>

<p class="commentary">Note that the <span class="extract"><span class="extract-syntax">domain</span></span> object itself, and its component parts if any, are
not placed in scope by this routine, though nothing prevents some other
code doing so.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">ScopeWithin</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain</span><span class="plain-syntax"> </span><span class="identifier-syntax">nosearch</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">domain</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">Look through the objects in the domain, avoiding "objectloop" in case</span>
<span class="plain-syntax">    </span><span class="comment-syntax">movements occur.</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax"> = </span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">domain</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">TestConcealment</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">obj</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">nosearch</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP52" class="paragraph-anchor"></a><b>&#167;52. DoScopeActionAndRecurse. </b>Level 3.
In all cases, the <span class="extract"><span class="extract-syntax">domain</span></span> itself is visited. There are then three possible
forms of recursion:
</p>

<ul class="items"><li>(a) To unconcealed objects which are inside, on top of, carried or worn by
the <span class="extract"><span class="extract-syntax">domain</span></span>: this is called "searching" in traditional I6 language and
is suppressed if <span class="extract"><span class="extract-syntax">domain</span></span> is the special value <span class="extract"><span class="extract-syntax">nosearch</span></span>.
</li><li>(b) To unconcealed component parts of the <span class="extract"><span class="extract-syntax">domain</span></span>.
</li><li>(c) To any other objects listed in the <span class="extract"><span class="extract-syntax">add_to_scope</span></span> property array, or
supplied by the <span class="extract"><span class="extract-syntax">add_to_scope</span></span> property routine, if it has one. (I7 does
not usually use <span class="extract"><span class="extract-syntax">add_to_scope</span></span>, but it remains a useful hook in the parser,
so it retains its old I6 library interpretation.)
</li></ul>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain</span><span class="plain-syntax"> </span><span class="identifier-syntax">nosearch</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">ad</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DoScopeAction</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax">(a)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">domain</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">nosearch</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">domain</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K1_room</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">K8_person</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">IsSeeThrough</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">) == </span><span class="constant-syntax">1</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="reserved-syntax">child</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax"> = </span><span class="reserved-syntax">sibling</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">domain</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">TestConcealment</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">obj</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">nosearch</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">(b)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">domain</span><span class="plain-syntax"> </span><span class="reserved-syntax">provides</span><span class="plain-syntax"> </span><span class="identifier-syntax">component_child</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">domain</span><span class="plain-syntax">.</span><span class="identifier-syntax">component_child</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">.</span><span class="identifier-syntax">component_sibling</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">domain</span><span class="plain-syntax"> == </span><span class="identifier-syntax">actor</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">TestConcealment</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">obj</span><span class="plain-syntax">) == </span><span class="reserved-syntax">false</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">next_obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">(c)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ad</span><span class="plain-syntax"> = </span><span class="identifier-syntax">domain</span><span class="plain-syntax">.&amp;</span><span class="identifier-syntax">add_to_scope</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ad</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="comment-syntax">Test if the property value is not an object.</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">metaclass</span><span class="plain-syntax">(</span><span class="identifier-syntax">ad</span><span class="plain-syntax">--&gt;0) == </span><span class="identifier-syntax">Object</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ats_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">+</span><span class="identifier-syntax">context</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RunRoutines</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">add_to_scope</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ats_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="identifier-syntax">domain</span><span class="plain-syntax">.#</span><span class="identifier-syntax">add_to_scope</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0 : (</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">*</span><span class="identifier-syntax">i</span><span class="plain-syntax">)&lt;</span><span class="identifier-syntax">n</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ad</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">DoScopeActionAndRecurse</span><span class="plain-syntax">(</span><span class="identifier-syntax">ad</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP53" class="paragraph-anchor"></a><b>&#167;53. DoScopeAction. </b>Level 4. This is where we take whatever action is to be performed as the
"visit" to each scoped object, and it's the bottom at last of the scope
mechanism.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">DoScopeAction</span><span class="plain-syntax"> </span><span class="identifier-syntax">item</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">6</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[DSA on "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">item</span><span class="plain-syntax">, </span><span class="string-syntax">" with reason = "</span><span class="plain-syntax">, </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">" p1 = "</span><span class="plain-syntax">, </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax">, </span><span class="string-syntax">" p2 = "</span><span class="plain-syntax">, </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TESTSCOPE_REASON</span><span class="plain-syntax">: </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">item</span><span class="plain-syntax"> == </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax">) </span><span class="identifier-syntax">parser_two</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOPOVERSCOPE_REASON</span><span class="plain-syntax">: </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_one</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PARSING_REASON</span><span class="plain-syntax">, </span><span class="identifier-syntax">TALKING_REASON</span><span class="plain-syntax">: </span><span class="identifier-syntax">MatchTextAgainstObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">scope_reason</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">parser_one</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP54" class="paragraph-anchor"></a><b>&#167;54. Parsing Object Names. </b>We now reach the final major block of code in the parser: the part which tries
to match a given object's name(s) against the text at word position <span class="extract"><span class="extract-syntax">match_from</span></span>
in the player's command, and calls <span class="extract"><span class="extract-syntax">MakeMatch</span></span> if it succeeds. There are
basically four possibilities: ME, a pronoun such as IT, a name which doesn't
begin misleadingly with a number, and a name which does. In the latter two
cases, we pass the job down to <span class="extract"><span class="extract-syntax">TryGivenObject</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">MatchTextAgainstObject</span><span class="plain-syntax"> </span><span class="identifier-syntax">item</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">ConsultNounFilterToken</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) { </span><span class="comment-syntax">If there's any text to match, that is</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NounWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">player</span><span class="plain-syntax"> == </span><span class="identifier-syntax">item</span><span class="plain-syntax">)) </span><span class="identifier-syntax">MakeMatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="comment-syntax">"me"</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">128</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">item</span><span class="plain-syntax">)) </span><span class="identifier-syntax">MakeMatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">Construing the current word as the start of a noun, can it refer to the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">object?</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TryGivenObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="comment-syntax">This case arises if the player has typed a number in</span>
<span class="plain-syntax">            </span><span class="comment-syntax">which is hypothetically an indefinite descriptor:</span>
<span class="plain-syntax">            </span><span class="comment-syntax">e.g. "take two clubs".  We have just checked the object</span>
<span class="plain-syntax">            </span><span class="comment-syntax">against the word "clubs", in the hope of eventually finding</span>
<span class="plain-syntax">            </span><span class="comment-syntax">two such objects.  But we also backtrack and check it</span>
<span class="plain-syntax">            </span><span class="comment-syntax">against the words "two clubs", in case it turns out to</span>
<span class="plain-syntax">            </span><span class="comment-syntax">be the 2 of Clubs from a pack of cards, say.  If it does</span>
<span class="plain-syntax">            </span><span class="comment-syntax">match against "two clubs", we tear up our original</span>
<span class="plain-syntax">            </span><span class="comment-syntax">assumption about the meaning of "two" and lapse back into</span>
<span class="plain-syntax">            </span><span class="comment-syntax">definite mode.</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TryGivenObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_nspec_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ResetDescriptors</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP55" class="paragraph-anchor"></a><b>&#167;55. TryGivenObject. </b><span class="extract"><span class="extract-syntax">TryGivenObject</span></span> tries to match as many words as possible in what has been
typed to the given object, <span class="extract"><span class="extract-syntax">obj</span></span>. If it manages any words matched at all,
it calls <span class="extract"><span class="extract-syntax">MakeMatch</span></span> to say so, then returns the number of words (or 1
if it was a match because of inadequate input).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">TryGivenObject</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">nomatch</span><span class="plain-syntax"> </span><span class="identifier-syntax">threshold</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">w</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">5</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"    Trying "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="string-syntax">" at word "</span><span class="plain-syntax">, </span><span class="identifier-syntax">wn</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nomatch</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>

<span class="comment-syntax"> If input has run out then always match, with only quality 0 (this saves</span>
<span class="comment-syntax"> time).</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nomatch</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">MakeMatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">,0);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">5</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"    Matched (0)^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="comment-syntax"> Ask the object to parse itself if necessary, sitting up and taking notice</span>
<span class="comment-syntax"> if it says the plural was used:</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax">.</span><span class="identifier-syntax">parse_name</span><span class="plain-syntax">~=0) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parser_action</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RunRoutines</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">,</span><span class="identifier-syntax">parse_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wn</span><span class="plain-syntax">=</span><span class="identifier-syntax">j</span><span class="plain-syntax">+</span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>

<span class="plain-syntax">          .</span><span class="identifier-syntax">MMbyPN</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_action</span><span class="plain-syntax"> == ##</span><span class="identifier-syntax">PluralFound</span><span class="plain-syntax">) </span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (~~</span><span class="identifier-syntax">allow_plurals</span><span class="plain-syntax">) </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">indef_type</span><span class="plain-syntax"> | </span><span class="identifier-syntax">PLURAL_BIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">indef_wanted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">INDEF_ALL_WANTED</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parser_trace</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">5</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"    Matched ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">k</span><span class="plain-syntax">, </span><span class="string-syntax">")^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">nomatch</span><span class="plain-syntax"> == </span><span class="reserved-syntax">false</span><span class="plain-syntax">) </span><span class="identifier-syntax">MakeMatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">,</span><span class="identifier-syntax">k</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">NoWordsMatch</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="comment-syntax">The default algorithm is simply to count up how many words pass the</span>
<span class="plain-syntax">    </span><span class="comment-syntax">Refers test:</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">parser_action</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NounWord</span><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">player</span><span class="plain-syntax"> == </span><span class="identifier-syntax">obj</span><span class="plain-syntax">) { </span><span class="identifier-syntax">k</span><span class="plain-syntax">=1; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">MMbyPN</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">w</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">128</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">w</span><span class="plain-syntax"> == </span><span class="identifier-syntax">obj</span><span class="plain-syntax">)) { </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">MMbyPN</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Refers</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">wn</span><span class="plain-syntax">-1) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        .</span><span class="identifier-syntax">NoWordsMatch</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indef_mode</span><span class="plain-syntax"> ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">parser_action</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">MMbyPN</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">threshold</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WorkMarkedAsUntruncatedPlural</span><span class="plain-syntax">(</span><span class="identifier-syntax">w</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Refers</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">wn</span><span class="plain-syntax">-1)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w</span><span class="plain-syntax">)</span>
<span class="plain-syntax">           </span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_noun_is_plural</span><span class="plain-syntax"> | (</span><span class="identifier-syntax">WorkMarkedAsUntruncatedPlural</span><span class="plain-syntax">(</span><span class="identifier-syntax">w</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">threshold</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">MMbyPN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP56" class="paragraph-anchor"></a><b>&#167;56. Refers. </b><span class="extract"><span class="extract-syntax">Refers</span></span> works out whether the word at number wnum can refer to the object
<span class="extract"><span class="extract-syntax">obj</span></span>, returning true or false.  The standard method is to see if the word
is listed under the <span class="extract"><span class="extract-syntax">name</span></span> property for the object, but this is more
complex in languages other than English.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">Refers</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">wnum</span><span class="plain-syntax">   </span><span class="identifier-syntax">wd</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageRefers</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">,</span><span class="identifier-syntax">wnum</span><span class="plain-syntax">); </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wnum</span><span class="plain-syntax">; </span><span class="identifier-syntax">wd</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">(); </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">indirect_parser_inflection</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_inflection</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">wd</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = -</span><span class="identifier-syntax">k</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parser_inflection</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">.&amp;</span><span class="identifier-syntax">m</span><span class="plain-syntax">; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">obj</span><span class="plain-syntax">.#</span><span class="identifier-syntax">m</span><span class="plain-syntax">)/</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">-1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">m</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wd</span><span class="plain-syntax"> == </span><span class="identifier-syntax">k</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">WordInProperty</span><span class="plain-syntax"> </span><span class="identifier-syntax">wd</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">prop</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">.&amp;</span><span class="identifier-syntax">prop</span><span class="plain-syntax">; </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">obj</span><span class="plain-syntax">.#</span><span class="identifier-syntax">prop</span><span class="plain-syntax">)/</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">m</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">l</span><span class="plain-syntax"> : </span><span class="identifier-syntax">m</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wd</span><span class="plain-syntax"> == </span><span class="identifier-syntax">k</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">m</span><span class="plain-syntax">) { </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP57" class="paragraph-anchor"></a><b>&#167;57. NounWord. </b><span class="extract"><span class="extract-syntax">NounWord</span></span> (which takes no arguments) returns:
</p>

<ul class="items"><li>(a) 0 if the next word is not in the dictionary or is but does not carry the
"noun" bit in its dictionary entry,
</li><li>(b) 1 if it is a word meaning "me",
</li><li>(c) the index in the pronoun table (plus 2) of the value field of a pronoun,
if it is a pronoun,
</li><li>(d) the address in the dictionary if it is a recognised noun.
</li></ul>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">NounWord</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ME1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ME2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ME3__WD</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">s</span><span class="plain-syntax"> : </span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">j</span><span class="plain-syntax">+3)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">+2;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax">-&gt;#</span><span class="identifier-syntax">dict_par1</span><span class="plain-syntax">) &amp; </span><span class="identifier-syntax">DICTPAR1_NOUN</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP58" class="paragraph-anchor"></a><b>&#167;58. TryNumber. </b><span class="extract"><span class="extract-syntax">TryNumber</span></span> takes word number <span class="extract"><span class="extract-syntax">wordnum</span></span> and tries to parse it as an (unsigned)
decimal number or the name of a small number, returning
</p>

<ul class="items"><li>(a) \(-1000\) if it is not a number
</li><li>(b) the number, if it has between 1 and 4 digits
</li><li>(c) 10000 if it has 5 or more digits.
</li></ul>
<p class="commentary">(The danger of allowing 5 digits is that Z-machine integers are only 16 bits
long, and anyway this routine isn't meant to be perfect: it only really needs
to be good enough to handle numeric descriptors such as those in TAKE 31 COINS
or DROP FOUR DAGGERS. In particular, it is not the way I7 "[number]" tokens
are parsed.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">TryNumber</span><span class="plain-syntax"> </span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">   </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> </span><span class="identifier-syntax">num</span><span class="plain-syntax"> </span><span class="identifier-syntax">len</span><span class="plain-syntax"> </span><span class="identifier-syntax">mul</span><span class="plain-syntax"> </span><span class="identifier-syntax">tot</span><span class="plain-syntax"> </span><span class="identifier-syntax">d</span><span class="plain-syntax"> </span><span class="identifier-syntax">digit</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWord</span><span class="plain-syntax">(); </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NumberWord</span><span class="plain-syntax">(</span><span class="identifier-syntax">j</span><span class="plain-syntax">); </span><span class="comment-syntax">Test for verbal forms ONE to THIRTY</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">*4+1; </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">; </span><span class="identifier-syntax">num</span><span class="plain-syntax"> = </span><span class="identifier-syntax">j</span><span class="plain-syntax">+</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">; </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">num</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">); </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordLength</span><span class="plain-syntax">(</span><span class="identifier-syntax">wordnum</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">len</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">4</span><span class="plain-syntax">) </span><span class="identifier-syntax">mul</span><span class="plain-syntax">=1000;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">len</span><span class="plain-syntax"> == </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="identifier-syntax">mul</span><span class="plain-syntax">=100;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">len</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="identifier-syntax">mul</span><span class="plain-syntax">=10;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">len</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">mul</span><span class="plain-syntax">=1;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">tot</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">len</span><span class="plain-syntax">-1;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">=0 : </span><span class="identifier-syntax">c</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">len</span><span class="plain-syntax"> : </span><span class="identifier-syntax">c</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">digit</span><span class="plain-syntax">=</span><span class="identifier-syntax">num</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">digit</span><span class="plain-syntax">=</span><span class="identifier-syntax">num</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'0'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'1'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'2'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'3'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">3</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'4'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">4</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'5'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">5</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'6'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">6</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'7'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">7</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'8'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">8</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> == </span><span class="character-syntax">'9'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">9</span><span class="plain-syntax">; </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">digok</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1000;</span>
<span class="plain-syntax">     .</span><span class="identifier-syntax">digok</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">tot</span><span class="plain-syntax"> = </span><span class="identifier-syntax">tot</span><span class="plain-syntax">+</span><span class="identifier-syntax">mul</span><span class="plain-syntax">*</span><span class="identifier-syntax">d</span><span class="plain-syntax">; </span><span class="identifier-syntax">mul</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mul</span><span class="plain-syntax">/10;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">len</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="identifier-syntax">tot</span><span class="plain-syntax">=10000;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">tot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP59" class="paragraph-anchor"></a><b>&#167;59. Gender. </b><span class="extract"><span class="extract-syntax">GetGender</span></span> returns 0 if the given animate object is female, and 1 if male,
and is abstracted as a routine in case something more elaborate is ever
needed.
</p>

<p class="commentary">For GNAs &mdash; gender/noun/animation combinations &mdash; see the {\it Inform Designer's
Manual}, 4th edition.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">GetGender</span><span class="plain-syntax"> </span><span class="identifier-syntax">person</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">person</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">female</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">+</span><span class="identifier-syntax">replacing</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">) [ </span><span class="identifier-syntax">GetGNAOfObject</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">gender</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">hasnt</span><span class="plain-syntax"> </span><span class="identifier-syntax">animate</span><span class="plain-syntax">) </span><span class="identifier-syntax">case</span><span class="plain-syntax"> = </span><span class="constant-syntax">6</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">male</span><span class="plain-syntax">) </span><span class="identifier-syntax">gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">male</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">female</span><span class="plain-syntax">) </span><span class="identifier-syntax">gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">female</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">neuter</span><span class="plain-syntax">) </span><span class="identifier-syntax">gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">neuter</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">gender</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">case</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageAnimateGender</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">gender</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageInanimateGender</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">gender</span><span class="plain-syntax"> == </span><span class="identifier-syntax">female</span><span class="plain-syntax">)   </span><span class="identifier-syntax">case</span><span class="plain-syntax"> = </span><span class="identifier-syntax">case</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">gender</span><span class="plain-syntax"> == </span><span class="identifier-syntax">neuter</span><span class="plain-syntax">)   </span><span class="identifier-syntax">case</span><span class="plain-syntax"> = </span><span class="identifier-syntax">case</span><span class="plain-syntax"> + </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">pluralname</span><span class="plain-syntax">) </span><span class="identifier-syntax">case</span><span class="plain-syntax"> = </span><span class="identifier-syntax">case</span><span class="plain-syntax"> + </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">case</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP60" class="paragraph-anchor"></a><b>&#167;60. Noticing Plurals. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">DetectPluralWord</span><span class="plain-syntax"> </span><span class="identifier-syntax">at</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">w</span><span class="plain-syntax"> </span><span class="identifier-syntax">swn</span><span class="plain-syntax"> </span><span class="identifier-syntax">outcome</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">swn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">; </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0:</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">n</span><span class="plain-syntax">:</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">COMMA_WORD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> -1) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WorkMarkedAsUntruncatedPlural</span><span class="plain-syntax">(</span><span class="identifier-syntax">w</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parser_action</span><span class="plain-syntax"> = ##</span><span class="identifier-syntax">PluralFound</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">outcome</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">swn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">outcome</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP61" class="paragraph-anchor"></a><b>&#167;61. Pronoun Handling. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">SetPronoun</span><span class="plain-syntax"> </span><span class="identifier-syntax">dword</span><span class="plain-syntax"> </span><span class="identifier-syntax">value</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x</span><span class="plain-syntax">+3)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">x</span><span class="plain-syntax"> == </span><span class="identifier-syntax">dword</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+2) = </span><span class="identifier-syntax">value</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RunTimeError</span><span class="plain-syntax">(14);</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">PronounValue</span><span class="plain-syntax"> </span><span class="identifier-syntax">dword</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x</span><span class="plain-syntax">+3)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">x</span><span class="plain-syntax"> == </span><span class="identifier-syntax">dword</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+2);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ResetVagueWords</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">; </span><span class="identifier-syntax">PronounNotice</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">); ];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">PronounNotice</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">g</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">player</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Object</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">g</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">GetGNAOfObject</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="reserved-syntax">has</span><span class="plain-syntax"> </span><span class="identifier-syntax">ambigpluralname</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">g</span><span class="plain-syntax"> % </span><span class="constant-syntax">6</span><span class="plain-syntax">) &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">) </span><span class="identifier-syntax">g</span><span class="plain-syntax"> = </span><span class="identifier-syntax">g</span><span class="plain-syntax"> - </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PronounNoticeFromGNA</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">g</span><span class="plain-syntax">);   </span><span class="comment-syntax">Singular form of the original GNA</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PronounNoticeFromGNA</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">g</span><span class="plain-syntax">+3); </span><span class="comment-syntax">Plural form of the original GNA</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PronounNoticeFromGNA</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">g</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">PronounNoticeFromGNA</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">g</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="identifier-syntax">bm</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bm</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PowersOfTwo_TB</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">g</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;0 : </span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x</span><span class="plain-syntax">+3)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bm</span><span class="plain-syntax"> &amp; (</span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+1)) ~= </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LanguagePronouns</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">x</span><span class="plain-syntax">+2) = </span><span class="identifier-syntax">obj</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">PronounNoticeHeldObjects</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CommandParserKit</span><span class="plain-syntax">`</span><span class="identifier-syntax">MANUAL_PRONOUNS_CFGF</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">objectloop</span><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax"> </span><span class="reserved-syntax">in</span><span class="plain-syntax"> </span><span class="identifier-syntax">player</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PronounNotice</span><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP62" class="paragraph-anchor"></a><b>&#167;62. Yes/No Questions. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">YesOrNo</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (::) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">location</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax"> || </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">player</span><span class="plain-syntax">) == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) </span><span class="identifier-syntax">KeyboardPrimitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">KeyboardPrimitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">, </span><span class="identifier-syntax">DrawStatusLine</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">-&gt;1;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">) { </span><span class="comment-syntax">at least one word entered</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;1;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">YES1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">YES2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">YES3__WD</span><span class="plain-syntax">) </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NO1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">NO2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">NO3__WD</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">YES_OR_NO_QUESTION_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"&gt; "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">YES_OR_NO_QUESTION_INTERNAL_R</span><span class="plain-syntax">; ];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP63" class="paragraph-anchor"></a><b>&#167;63. Numerical Choices. </b>This crude function prompts the player for a number from 1 to <span class="extract"><span class="extract-syntax">max</span></span>, waits for
this to be typed at the keyboard, then returns the choice made.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">NumberChosenByPlayer</span><span class="plain-syntax"> </span><span class="identifier-syntax">max</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> </span><span class="identifier-syntax">wl</span><span class="plain-syntax"> </span><span class="identifier-syntax">sign</span><span class="plain-syntax"> </span><span class="identifier-syntax">base</span><span class="plain-syntax"> </span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="identifier-syntax">digit</span><span class="plain-syntax"> </span><span class="identifier-syntax">ch</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">max</span><span class="plain-syntax"> &lt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (::) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"&gt;"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">location</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax"> || </span><span class="reserved-syntax">parent</span><span class="plain-syntax">(</span><span class="identifier-syntax">player</span><span class="plain-syntax">) == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">) </span><span class="identifier-syntax">KeyboardPrimitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">KeyboardPrimitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer2</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">, </span><span class="identifier-syntax">DrawStatusLine</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">-&gt;1;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax"> + </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">-&gt;5;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wl</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">-&gt;4;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> = </span><span class="identifier-syntax">buffer2</span><span class="plain-syntax"> + </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax"> * </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;3;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wl</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parse2</span><span class="plain-syntax">--&gt;2;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax">) { </span><span class="comment-syntax">at least one word entered</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">sign</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">base</span><span class="plain-syntax"> = </span><span class="constant-syntax">10</span><span class="plain-syntax">; </span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wl</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wa</span><span class="plain-syntax">-&gt;0;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wa</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">CHARSIZE</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ch</span><span class="plain-syntax"> ~= </span><span class="character-syntax">'0'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'1'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'2'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'3'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'4'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'5'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'6'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'7'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'8'</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="character-syntax">'9'</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">digit</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> - </span><span class="character-syntax">'0'</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">digit_count</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">base</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="constant-syntax">2</span><span class="plain-syntax">:  </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">17</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="constant-syntax">10</span><span class="plain-syntax">:</span>
<span class="plain-syntax">                        #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">6</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">5</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">3276</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> == </span><span class="constant-syntax">3276</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sign</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">digit</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">7</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sign</span><span class="plain-syntax"> == -1 &amp;&amp; </span><span class="identifier-syntax">digit</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">8</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            }</span>
<span class="plain-syntax">                        }</span>
<span class="plain-syntax">                        #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">; </span><span class="comment-syntax">i.e., if (WORDSIZE == 4)</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">11</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">10</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">214748364</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> == </span><span class="constant-syntax">214748364</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sign</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">digit</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">7</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sign</span><span class="plain-syntax"> == -1 &amp;&amp; </span><span class="identifier-syntax">digit</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">8</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                            }</span>
<span class="plain-syntax">                        }</span>
<span class="plain-syntax">                        #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="constant-syntax">16</span><span class="plain-syntax">: </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">5</span><span class="plain-syntax">) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">digit</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax"> &amp;&amp; </span><span class="identifier-syntax">digit</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">base</span><span class="plain-syntax">) </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="identifier-syntax">base</span><span class="plain-syntax">*</span><span class="identifier-syntax">n</span><span class="plain-syntax"> + </span><span class="identifier-syntax">digit</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wl</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wa</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> + </span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">CHARSIZE</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">*</span><span class="identifier-syntax">sign</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">max</span><span class="plain-syntax">)) </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        .</span><span class="identifier-syntax">Retry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax">; </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax"> = </span><span class="identifier-syntax">max</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PICK_A_NUMBER_INTERNAL_RM</span><span class="plain-syntax">(</span><span class="character-syntax">'A'</span><span class="plain-syntax">, </span><span class="identifier-syntax">max</span><span class="plain-syntax">); </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parsed_number</span><span class="plain-syntax"> = </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">PICK_A_NUMBER_INTERNAL_R</span><span class="plain-syntax">; ];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP64" class="paragraph-anchor"></a><b>&#167;64. Number Words. </b>Not much of a parsing routine: we look through an array of pairs of number
words (single words) and their numeric equivalents.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">NumberWord</span><span class="plain-syntax"> </span><span class="identifier-syntax">o</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LanguageNumbers</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1 : </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">n</span><span class="plain-syntax"> : </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+2)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">o</span><span class="plain-syntax"> == </span><span class="identifier-syntax">LanguageNumbers</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">LanguageNumbers</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP65" class="paragraph-anchor"></a><b>&#167;65. Tracing. </b>Uncomment this line and rebuild the kit to enable tracing of what the algorithm
below is doing. (This constant should not be used anywhere except in this file,
where <span class="extract"><span class="extract-syntax">#Ifdef</span></span> on it will have the expected effect: elsewhere, it might not.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="comment-syntax">Constant LKTRACE_CHOOSE_OBJECTS;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP66" class="paragraph-anchor"></a><b>&#167;66. Choose Objects. </b>This material, the final body of code in the parser, is an I7 addition.
The I6 parser leaves it to the user to provide a <span class="extract"><span class="extract-syntax">ChooseObjects</span></span> routine
to decide between possibilities when the situation is ambiguous. For I7
use, we provide a <span class="extract"><span class="extract-syntax">ChooseObjects</span></span> which essentially runs the "does the
player mean" rulebook to decide, though this is not obvious from the
code below because it is hidden in the <span class="extract"><span class="extract-syntax">CheckDPMR</span></span> routine &mdash; which
is defined in the Standard Rules, not here.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="comment-syntax">the highest value returned by CheckDPMR (see the Standard Rules)</span>
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">HIGHEST_DPMR_SCORE</span><span class="plain-syntax"> = </span><span class="constant-syntax">4</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">Array</span><span class="plain-syntax"> </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax"> --&gt; (</span><span class="identifier-syntax">MATCH_LIST_WORDS</span><span class="plain-syntax">+1);</span>

<span class="comment-syntax">swap alt_match_list with match_list/number_matched</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">COBJ__SwapMatches</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">swap the counts</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> = </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="comment-syntax">swap the values</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">) </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">x</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">--) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">-1) = </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ChooseObjects</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">code</span><span class="plain-syntax">  </span><span class="identifier-syntax">l</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">swn</span><span class="plain-syntax"> </span><span class="identifier-syntax">spcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">code</span><span class="plain-syntax">&lt;2) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cobj_flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        .</span><span class="identifier-syntax">CodeOne</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parameters</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[scoring "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="string-syntax">" (second)]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ScoreDabCombo</span><span class="plain-syntax">(</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">, </span><span class="identifier-syntax">obj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[scoring "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="string-syntax">" (first) in "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;0, </span><span class="string-syntax">" combinations]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;0: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">spcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScoreDabCombo</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">spcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">HIGHEST_DPMR_SCORE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[scored "</span><span class="plain-syntax">, </span><span class="identifier-syntax">spcount</span><span class="plain-syntax">, </span><span class="string-syntax">" - best possible]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">spcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">spcount</span><span class="plain-syntax">&gt;</span><span class="identifier-syntax">l</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">spcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cobj_flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        .</span><span class="identifier-syntax">CodeTwo</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[scoring "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="string-syntax">" (simple); parameters = "</span><span class="plain-syntax">, </span><span class="identifier-syntax">parameters</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">" aw = "</span><span class="plain-syntax">, </span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parameters</span><span class="plain-syntax">==0) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScoreDabCombo</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="identifier-syntax">advance_warning</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScoreDabCombo</span><span class="plain-syntax">(</span><span class="identifier-syntax">obj</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ScoreDabCombo</span><span class="plain-syntax">(</span><span class="identifier-syntax">parser_results</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">INP1_PRES</span><span class="plain-syntax">, </span><span class="identifier-syntax">obj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"[choosing a cobj strategy: "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">swn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">spcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">PREPOSITION_TT</span><span class="plain-syntax">) </span><span class="identifier-syntax">pcount</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_ttype</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ELEMENTARY_TT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TOPIC_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">spcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">CodeTwo</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">num_words</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">l</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">(); </span><span class="identifier-syntax">wn</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">THEN1__WD</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">l</span><span class="plain-syntax"> ~= -1 </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">l</span><span class="plain-syntax">-&gt;#</span><span class="identifier-syntax">dict_par1</span><span class="plain-syntax">) &amp; </span><span class="identifier-syntax">DICTPAR1_PREP</span><span class="plain-syntax">) { </span><span class="identifier-syntax">wn</span><span class="plain-syntax">++; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ALL1__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL2__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL3__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL4__WD</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALL5__WD</span><span class="plain-syntax">) { </span><span class="identifier-syntax">wn</span><span class="plain-syntax">++; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">SafeSkipDescriptors</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="comment-syntax">save the current match state</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">VM_CopyWords</span><span class="plain-syntax">(</span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">, </span><span class="identifier-syntax">match_list</span><span class="plain-syntax">, </span><span class="identifier-syntax">alt_match_list</span><span class="plain-syntax">+</span><span class="identifier-syntax">WORDSIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="comment-syntax">now get all the matches for the second noun</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">match_length</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">match_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">SearchScope</span><span class="plain-syntax">(</span><span class="identifier-syntax">actor</span><span class="plain-syntax">, </span><span class="identifier-syntax">actors_location</span><span class="plain-syntax">, </span><span class="identifier-syntax">line_tdata</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">pcount</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_matched</span><span class="plain-syntax">, </span><span class="string-syntax">" possible second nouns]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">swn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cobj_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="comment-syntax">restore match variables</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">COBJ__SwapMatches</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_from</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_filter</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_length</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">spcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">CodeOne</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pcount</span><span class="plain-syntax"> = </span><span class="identifier-syntax">spcount</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">swn</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"nothing interesting]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cobj_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">jump</span><span class="plain-syntax"> </span><span class="identifier-syntax">CodeTwo</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">ScoreDabCombo</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">b</span><span class="plain-syntax">  </span><span class="identifier-syntax">result</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">action</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">act_requester</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">noun</span><span class="plain-syntax">; @</span><span class="identifier-syntax">push</span><span class="plain-syntax"> </span><span class="identifier-syntax">second</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">action</span><span class="plain-syntax"> = </span><span class="identifier-syntax">action_to_be</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">act_requester</span><span class="plain-syntax"> = </span><span class="identifier-syntax">player</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">action_reversed</span><span class="plain-syntax">) { </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">b</span><span class="plain-syntax">; </span><span class="identifier-syntax">second</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> { </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a</span><span class="plain-syntax">; </span><span class="identifier-syntax">second</span><span class="plain-syntax"> = </span><span class="identifier-syntax">b</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CheckDPMR</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">second</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">noun</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">act_requester</span><span class="plain-syntax">; @</span><span class="identifier-syntax">pull</span><span class="plain-syntax"> </span><span class="identifier-syntax">action</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">LKTRACE_CHOOSE_OBJECTS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"["</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">a</span><span class="plain-syntax">, </span><span class="string-syntax">" / "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">b</span><span class="plain-syntax">, </span><span class="string-syntax">" =&gt; "</span><span class="plain-syntax">, </span><span class="identifier-syntax">result</span><span class="plain-syntax">, </span><span class="string-syntax">"]^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">result</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">CheckDPMR</span><span class="plain-syntax"> </span><span class="identifier-syntax">result</span><span class="plain-syntax"> </span><span class="identifier-syntax">sinp1</span><span class="plain-syntax"> </span><span class="identifier-syntax">sinp2</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sinp1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">inp1</span><span class="plain-syntax">; </span><span class="identifier-syntax">sinp2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">inp2</span><span class="plain-syntax">; </span><span class="identifier-syntax">inp1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">noun</span><span class="plain-syntax">; </span><span class="identifier-syntax">inp2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">second</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FollowRulebook</span><span class="plain-syntax">(</span><span class="identifier-syntax">DOES_THE_PLAYER_MEAN_RB</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inp1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sinp1</span><span class="plain-syntax">; </span><span class="identifier-syntax">inp2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sinp2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">rv</span><span class="plain-syntax">) &amp;&amp; </span><span class="identifier-syntax">RulebookSucceeded</span><span class="plain-syntax">()) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ResultOfRule</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RBNO4_OUTCOME</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RBNO3_OUTCOME</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RBNO2_OUTCOME</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RBNO1_OUTCOME</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RBNO0_OUTCOME</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP67" class="paragraph-anchor"></a><b>&#167;67. Default Topic. </b>A default value for the I7 sort-of-kind "topic", which never matches.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">+</span><span class="identifier-syntax">replacing</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="identifier-syntax">BasicInformKit</span><span class="plain-syntax">) [ </span><span class="identifier-syntax">DefaultTopic</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">; ];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP68" class="paragraph-anchor"></a><b>&#167;68. Recognition-only-GPR. </b>An I6 general parsing routine to look at words from the position marker
<span class="extract"><span class="extract-syntax">wn</span></span> in the player's command to see if they match the contents of the
text <span class="extract"><span class="extract-syntax">txt</span></span>, returning either <span class="extract"><span class="extract-syntax">GPR_PREPOSITION</span></span> or <span class="extract"><span class="extract-syntax">GPR_FAIL</span></span>
according to whether a match could be made. This is used when the an
object's name is set to include one of its properties, and the property in
question is a text: "A flowerpot is a kind of thing. A flowerpot
has a text called pattern. Understand the pattern property as
describing a flowerpot." When the player types EXAMINE STRIPED FLOWERPOT,
and there is a flowerpot in scope, the following routine is called to
test whether its pattern property &mdash; a text &mdash; matches any words
at the position STRIPED FLOWERPOT. Assuming a pot does indeed have the
pattern "striped", the routine advances <span class="extract"><span class="extract-syntax">wn</span></span> by 1 and returns
<span class="extract"><span class="extract-syntax">GPR_PREPOSITION</span></span> to indicate a match.
</p>

<p class="commentary">This kind of GPR is called a "recognition-only-GPR", because it only
recognises an existing value: it doesn't parse a new one.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">TEXT_TY_ROGPR</span><span class="plain-syntax"> </span><span class="identifier-syntax">txt</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">cp</span><span class="plain-syntax"> </span><span class="identifier-syntax">r</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">txt</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cp</span><span class="plain-syntax"> = </span><span class="identifier-syntax">txt</span><span class="plain-syntax">--&gt;0; </span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TEXT_TY_Temporarily_Transmute</span><span class="plain-syntax">(</span><span class="identifier-syntax">txt</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">r</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TEXT_TY_ROGPRI</span><span class="plain-syntax">(</span><span class="identifier-syntax">txt</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEXT_TY_Untransmute</span><span class="plain-syntax">(</span><span class="identifier-syntax">txt</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="identifier-syntax">cp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">r</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">TEXT_TY_ROGPRI</span><span class="plain-syntax"> </span><span class="identifier-syntax">txt</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> </span><span class="identifier-syntax">len</span><span class="plain-syntax"> </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> </span><span class="identifier-syntax">wl</span><span class="plain-syntax"> </span><span class="identifier-syntax">wpos</span><span class="plain-syntax"> </span><span class="identifier-syntax">wach</span><span class="plain-syntax"> </span><span class="identifier-syntax">bdm</span><span class="plain-syntax"> </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> </span><span class="identifier-syntax">own</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bdm</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">; </span><span class="identifier-syntax">own</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PVFieldCapacity</span><span class="plain-syntax">(</span><span class="identifier-syntax">txt</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax">=0: </span><span class="identifier-syntax">pos</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">len</span><span class="plain-syntax">: </span><span class="identifier-syntax">pos</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax"> == </span><span class="identifier-syntax">len</span><span class="plain-syntax">) </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PVField</span><span class="plain-syntax">(</span><span class="identifier-syntax">txt</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ch</span><span class="plain-syntax"> == </span><span class="constant-syntax">32</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="constant-syntax">9</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="constant-syntax">10</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bdm</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">bdm</span><span class="plain-syntax"> = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wpos</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">wl</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ch</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bdm</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">bdm</span><span class="plain-syntax"> = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">NextWordStopped</span><span class="plain-syntax">() == -1) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAddress</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wl</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordLength</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wpos</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wach</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wa</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">wpos</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wach</span><span class="plain-syntax"> = </span><span class="identifier-syntax">wa</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">wpos</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wach</span><span class="plain-syntax"> ~= </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> </span><span class="reserved-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">TEXT_TY_RevCase</span><span class="plain-syntax">(</span><span class="identifier-syntax">ch</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wpos</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">own</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_FAIL</span><span class="plain-syntax">; </span><span class="comment-syntax">Progress must be made to avoid looping</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">GPR_PREPOSITION</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP69" class="paragraph-anchor"></a><b>&#167;69. RunRoutines. </b>This function may not be very well-named, but the idea is to take a property
of a given object and either to print it (and return <span class="extract"><span class="extract-syntax">true</span></span>) if it's a string,
and call it (and pass along its return value) if it's a routine. If the
object does not provide the property, we act on the default value for the
property if it has one, and otherwise do nothing (and return <span class="extract"><span class="extract-syntax">false</span></span>).
</p>

<p class="commentary">The I6 pseudo-object <span class="extract"><span class="extract-syntax">thedark</span></span> is used to give the impression that Darkness
is a room in its own right, which is not really true. Note that it is not
permitted to have properties other than the three named here: all other
properties are redirected to the current location's object.
</p>

<p class="commentary">At one time this function correctly handled the case of a common property
whose default value was itself a function which could be run; but this is
now awkward to compile (since it needed the magic compiler-defimed constant
INDIV_PROP_START, existing on Inform 6 for Glulx but not on other platforms),
and in the Inform 7 world it was a facility never used.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">RunRoutines</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> </span><span class="identifier-syntax">prop</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax"> == </span><span class="identifier-syntax">thedark</span><span class="plain-syntax">) </span><span class="identifier-syntax">obj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">real_location</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">obj</span><span class="plain-syntax">.&amp;</span><span class="identifier-syntax">prop</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">rfalse</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">obj</span><span class="plain-syntax">.</span><span class="identifier-syntax">prop</span><span class="plain-syntax">();</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP70" class="paragraph-anchor"></a><b>&#167;70. Setting the Player's Command. </b>In effect, the text typed most recently by the player is a sort of
text already, though it isn't in text format, and doesn't live on
the heap.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">SetPlayersCommand</span><span class="plain-syntax"> </span><span class="identifier-syntax">from_txt</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> </span><span class="identifier-syntax">len</span><span class="plain-syntax"> </span><span class="identifier-syntax">at</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">cp</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cp</span><span class="plain-syntax"> = </span><span class="identifier-syntax">from_txt</span><span class="plain-syntax">--&gt;0; </span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TEXT_TY_Temporarily_Transmute</span><span class="plain-syntax">(</span><span class="identifier-syntax">from_txt</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TEXT_TY_CharacterLength</span><span class="plain-syntax">(</span><span class="identifier-syntax">from_txt</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">len</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-2) </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">-2;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Iftrue</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHARSIZE</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;1 = </span><span class="identifier-syntax">len</span><span class="plain-syntax">; </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0:</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">len</span><span class="plain-syntax">:</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">at</span><span class="plain-syntax">) = </span><span class="identifier-syntax">CharToCase</span><span class="plain-syntax">(</span><span class="identifier-syntax">PVField</span><span class="plain-syntax">(</span><span class="identifier-syntax">from_txt</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">), </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (:</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">:</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">-&gt;(</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifnot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">len</span><span class="plain-syntax">; </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0:</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">len</span><span class="plain-syntax">:</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+</span><span class="identifier-syntax">at</span><span class="plain-syntax">) = </span><span class="identifier-syntax">CharToCase</span><span class="plain-syntax">(</span><span class="identifier-syntax">PVField</span><span class="plain-syntax">(</span><span class="identifier-syntax">from_txt</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">), </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (:</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">INPUT_BUFFER_LEN</span><span class="plain-syntax">:</span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">buffer</span><span class="plain-syntax">--&gt;(</span><span class="identifier-syntax">at</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">) = </span><span class="character-syntax">' '</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TokeniseInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">buffer</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEXT_TY_Untransmute</span><span class="plain-syntax">(</span><span class="identifier-syntax">from_txt</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="identifier-syntax">cp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP71" class="paragraph-anchor"></a><b>&#167;71. Multiple Object List. </b>The parser uses one data structure which is really a list: but which can't
be represented as such because the heap might not exist. This is the multiple
object list, which is used to handle commands like TAKE ALL by firing off a
sequence of actions with one of the objects taken from entries in turn of
the list. The following converts it to a list structure.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">LIST_OF_TY_Mol</span><span class="plain-syntax"> </span><span class="identifier-syntax">list</span><span class="plain-syntax"> </span><span class="identifier-syntax">len</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WeakKindOfPV</span><span class="plain-syntax">(</span><span class="identifier-syntax">list</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">LIST_OF_TY</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LIST_OF_TY_SetLength</span><span class="plain-syntax">(</span><span class="identifier-syntax">list</span><span class="plain-syntax">, </span><span class="identifier-syntax">len</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">len</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LIST_OF_TY_PutItem</span><span class="plain-syntax">(</span><span class="identifier-syntax">list</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">list</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">LIST_OF_TY_Set_Mol</span><span class="plain-syntax"> </span><span class="identifier-syntax">list</span><span class="plain-syntax"> </span><span class="identifier-syntax">len</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WeakKindOfPV</span><span class="plain-syntax">(</span><span class="identifier-syntax">list</span><span class="plain-syntax">) ~= </span><span class="identifier-syntax">LIST_OF_TY</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PVField</span><span class="plain-syntax">(</span><span class="identifier-syntax">list</span><span class="plain-syntax">, </span><span class="identifier-syntax">LIST_LENGTH_F</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">len</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">63</span><span class="plain-syntax">) </span><span class="identifier-syntax">len</span><span class="plain-syntax"> = </span><span class="constant-syntax">63</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">len</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1: </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">len</span><span class="plain-syntax">: </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">multiple_object</span><span class="plain-syntax">--&gt;</span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PVField</span><span class="plain-syntax">(</span><span class="identifier-syntax">list</span><span class="plain-syntax">, </span><span class="identifier-syntax">LIST_ITEM_BASE</span><span class="plain-syntax">+</span><span class="identifier-syntax">i</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">];</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprevoff">&#10094;</li><li class="progresscurrent">prs</li><li class="progresssection"><a href="S-tkn.html">tkn</a></li><li class="progressnext"><a href="S-tkn.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

